generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 8
/
version_test.go
41 lines (36 loc) · 971 Bytes
/
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
package ftl
import (
"testing"
"github.com/alecthomas/assert/v2"
)
func TestIsVersionAtLeastMin(t *testing.T) {
tests := []struct {
v string
minVersion string
want bool
}{
// Test case for minFTLVersion being undefined
{"1.2.3", "", true},
// Test cases for !IsRelease
{"dev", "dev", true},
{"dev", "1.2.3", true},
{"1.2.3", "dev", true},
{"1.2.3", "1.2", true},
{"2.0", "1.2.3", true},
{"a.b.c", "1.2.3", true},
// Test cases for comparator loop
{"1.2.3", "1.2.3", true},
{"2.2.3", "1.2.3", true},
{"1.3.3", "1.2.3", true},
{"1.2.4", "1.2.3", true},
{"2.0.0", "1.2.3", true},
{"1.3.0", "1.2.3", true},
{"1.2.3", "2.2.3", false},
{"1.2.3", "1.3.3", false},
{"1.2.3", "1.2.4", false},
}
for _, test := range tests {
got := IsVersionAtLeastMin(test.v, test.minVersion)
assert.Equal(t, test.want, got, "With v=%v and minVersion=%v, got %t, but want %t", test.v, test.minVersion, got, test.want)
}
}