MCPcopy
hub / github.com/gin-gonic/gin / TestMappingFormWithEmptyToDefault

Function TestMappingFormWithEmptyToDefault

binding/form_mapping_test.go:167–174  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

165}
166
167func TestMappingFormWithEmptyToDefault(t *testing.T) {
168 var s struct {
169 F string `form:"field,default=DefVal"`
170 }
171 err := mapForm(&s, map[string][]string{"field": {""}})
172 require.NoError(t, err)
173 assert.Equal(t, "DefVal", s.F)
174}
175
176func TestMapFormWithTag(t *testing.T) {
177 var s struct {

Callers

nothing calls this directly

Calls 1

mapFormFunction · 0.85

Tested by

no test coverage detected