mirror of
https://github.com/gin-gonic/gin.git
synced 2026-06-04 17:58:14 +08:00
fix broken tests
This commit is contained in:
parent
7b7f800b2c
commit
47a2602fa0
@ -915,7 +915,7 @@ func TestMappingCustomSliceOfSliceUnmarshalTextDefault(t *testing.T) {
|
|||||||
var s struct {
|
var s struct {
|
||||||
FileData []customPathUnmarshalText `form:"path,default=bar/foo;bar/foo/spam,parser=encoding.TextUnmarshaler" collection_format:"csv"`
|
FileData []customPathUnmarshalText `form:"path,default=bar/foo;bar/foo/spam,parser=encoding.TextUnmarshaler" collection_format:"csv"`
|
||||||
}
|
}
|
||||||
err := mappingByPtr(&s, formSource{"path": {}}, "form")
|
err := mappingByPtr(&s, formSource{"path": nil}, "form")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, []customPathUnmarshalText{{"bar", "foo"}, {"bar", "foo", "spam"}}, s.FileData)
|
assert.Equal(t, []customPathUnmarshalText{{"bar", "foo"}, {"bar", "foo", "spam"}}, s.FileData)
|
||||||
}
|
}
|
||||||
@ -994,7 +994,7 @@ func TestMappingCustomArrayOfArrayUnmarshalTextDefault(t *testing.T) {
|
|||||||
var s struct {
|
var s struct {
|
||||||
FileData []objectIDUnmarshalText `form:"ids,default=664a062ac74a8ad104e0e80e;664a062ac74a8ad104e0e80f,parser=encoding.TextUnmarshaler" collection_format:"csv"`
|
FileData []objectIDUnmarshalText `form:"ids,default=664a062ac74a8ad104e0e80e;664a062ac74a8ad104e0e80f,parser=encoding.TextUnmarshaler" collection_format:"csv"`
|
||||||
}
|
}
|
||||||
err := mappingByPtr(&s, formSource{"ids": {}}, "form")
|
err := mappingByPtr(&s, formSource{"ids": nil}, "form")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, []objectIDUnmarshalText{id1, id2}, s.FileData)
|
assert.Equal(t, []objectIDUnmarshalText{id1, id2}, s.FileData)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user