MCPcopy
hub / github.com/gofiber/fiber / Test_parseToStruct_MismatchedData

Function Test_parseToStruct_MismatchedData

binder/mapping_test.go:337–353  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

335}
336
337func Test_parseToStruct_MismatchedData(t *testing.T) {
338 t.Parallel()
339
340 type User struct {
341 Name string `query:"name"`
342 Age int `query:"age"`
343 }
344
345 data := map[string][]string{
346 "name": {"John"},
347 "age": {"invalidAge"},
348 }
349
350 err := parseToStruct("query", &User{}, data)
351 require.Error(t, err)
352 require.EqualError(t, err, "schema: error converting value for \"age\"")
353}
354
355func Test_formatBindData_ErrorCases(t *testing.T) {
356 t.Parallel()

Callers

nothing calls this directly

Calls 2

parseToStructFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected