fix: slice deserialization should return all errors

This commit is contained in:
yusing
2025-01-11 01:39:03 +08:00
parent e7bb6bc798
commit 28b5d44e11
2 changed files with 9 additions and 9 deletions

View File

@@ -166,16 +166,9 @@ func TestStringToSlice(t *testing.T) {
ExpectNoError(t, err)
ExpectDeepEqual(t, dst, []string{"a", "b", "c"})
})
t.Run("multiline", func(t *testing.T) {
dst := make([]string, 0)
convertible, err := ConvertString("- a\n- b\n- c", reflect.ValueOf(&dst))
ExpectTrue(t, convertible)
ExpectNoError(t, err)
ExpectDeepEqual(t, dst, []string{"a", "b", "c"})
})
t.Run("yaml-like", func(t *testing.T) {
dst := make([]string, 0)
convertible, err := ConvertString(" - a\n - b\n - c", reflect.ValueOf(&dst))
convertible, err := ConvertString("- a\n- b\n- c", reflect.ValueOf(&dst))
ExpectTrue(t, convertible)
ExpectNoError(t, err)
ExpectDeepEqual(t, dst, []string{"a", "b", "c"})