forked from mikefarah/yq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
version_test.go
51 lines (47 loc) · 1.05 KB
/
version_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
import "testing"
func TestGetVersionDisplay(t *testing.T) {
var expectedVersion = ProductName + " version " + Version
if VersionPrerelease != "" {
expectedVersion = expectedVersion + "-" + VersionPrerelease
}
expectedVersion = expectedVersion + "\n"
tests := []struct {
name string
want string
}{
{
name: "Display Version",
want: expectedVersion,
},
}
for _, tt := range tests {
if got := GetVersionDisplay(); got != tt.want {
t.Errorf("%q. GetVersionDisplay() = %v, want %v", tt.name, got, tt.want)
}
}
}
func Test_getHumanVersion(t *testing.T) {
GitDescribe = "e42813d"
GitCommit = "e42813d+CHANGES"
var wanted string
if VersionPrerelease == "" {
wanted = GitDescribe
} else {
wanted = "e42813d-" + VersionPrerelease + " (e42813d+CHANGES)"
}
tests := []struct {
name string
want string
}{
{
name: "Git Variables defined",
want: wanted,
},
}
for _, tt := range tests {
if got := getHumanVersion(); got != tt.want {
t.Errorf("%q. getHumanVersion() = %v, want %v", tt.name, got, tt.want)
}
}
}