chore: add more tests (#3006)
This commit is contained in:
@@ -15,8 +15,10 @@ func TestCompareVersions(t *testing.T) {
|
||||
out bool
|
||||
}{
|
||||
{"1", "1.0.1", ">", false},
|
||||
{"1.0.1", "1.0", "<", false},
|
||||
{"1", "0.9.9", ">", true},
|
||||
{"1", "1.0-1", "<", true},
|
||||
{"1", "1.0-1", "!", false},
|
||||
{"1.0.1", "1-0.1", "<", false},
|
||||
{"1.0.1", "1.0.1", "==", true},
|
||||
{"1.0.1", "1.0.2", "==", false},
|
||||
@@ -37,3 +39,21 @@ func TestCompareVersions(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestStrsToInts(t *testing.T) {
|
||||
testCases := []struct {
|
||||
input []string
|
||||
expected []int64
|
||||
}{
|
||||
{[]string{}, nil},
|
||||
{[]string{"1", "2", "3"}, []int64{1, 2, 3}},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run("", func(t *testing.T) {
|
||||
actual := strsToInts(tc.input)
|
||||
assert.Equal(t, tc.expected, actual)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user