added tests for feature and coverage

This commit is contained in:
Pratham Gadkari 2025-11-15 22:28:32 +05:30
parent b4d09053db
commit 513a86e17f

View File

@ -715,3 +715,22 @@ func TestMappingEmptyValues(t *testing.T) {
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)
}