Refactor StringsToInt64s (#29967)
And close #27176 (cherry picked from commit cdb4d1a8db096d60dba04728924dab85def45b19)
This commit is contained in:
parent
f8060bb5d9
commit
e5920b4a62
12 changed files with 30 additions and 27 deletions
|
@ -138,12 +138,13 @@ func TestStringsToInt64s(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
assert.Equal(t, expected, result)
|
||||
}
|
||||
testSuccess(nil, nil)
|
||||
testSuccess([]string{}, []int64{})
|
||||
testSuccess([]string{"-1234"}, []int64{-1234})
|
||||
testSuccess([]string{"1", "4", "16", "64", "256"},
|
||||
[]int64{1, 4, 16, 64, 256})
|
||||
testSuccess([]string{"1", "4", "16", "64", "256"}, []int64{1, 4, 16, 64, 256})
|
||||
|
||||
_, err := StringsToInt64s([]string{"-1", "a", "$"})
|
||||
ints, err := StringsToInt64s([]string{"-1", "a"})
|
||||
assert.Len(t, ints, 0)
|
||||
assert.Error(t, err)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue