From 513a86e17fa3ffed325c7f4f41fa3a919ce32afd Mon Sep 17 00:00:00 2001 From: Pratham Gadkari Date: Sat, 15 Nov 2025 22:28:32 +0530 Subject: [PATCH] added tests for feature and coverage --- binding/form_mapping_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/binding/form_mapping_test.go b/binding/form_mapping_test.go index 006eddf1..d0086d31 100644 --- a/binding/form_mapping_test.go +++ b/binding/form_mapping_test.go @@ -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) +}