mirror of
https://github.com/gin-gonic/gin.git
synced 2025-12-13 13:12:17 +08:00
added tests for feature and coverage
This commit is contained in:
parent
b4d09053db
commit
513a86e17f
@ -715,3 +715,22 @@ func TestMappingEmptyValues(t *testing.T) {
|
|||||||
assert.Equal(t, []int{1, 2, 3}, s.SliceCsv)
|
assert.Equal(t, []int{1, 2, 3}, s.SliceCsv)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type testCustom struct {
|
||||||
|
Value string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *testCustom) UnmarshalParam(param string) error {
|
||||||
|
t.Value = "prefix_" + param
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestTrySetCustomIntegration(t *testing.T) {
|
||||||
|
var s struct {
|
||||||
|
F testCustom `form:"f"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := mappingByPtr(&s, formSource{"f": {"hello"}}, "form")
|
||||||
|
require.NoError(t, err)
|
||||||
|
assert.Equal(t, "prefix_hello", s.F.Value)
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user