MCPcopy Index your code
hub / github.com/labstack/echo / TestValueBinder_Int_errorMessage

Function TestValueBinder_Int_errorMessage

binder_test.go:659–672  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

657}
658
659func TestValueBinder_Int_errorMessage(t *testing.T) {
660 // int/uint (without byte size) has a little bit different error message so test these separately
661 c := createTestContext("/search?param=nope", nil, nil)
662 b := QueryParamsBinder(c).FailFast(false)
663
664 destInt := 99
665 destUint := uint(98)
666 errs := b.Int("param", &destInt).Uint("param", &destUint).BindErrors()
667
668 assert.Equal(t, 99, destInt)
669 assert.Equal(t, uint(98), destUint)
670 assert.EqualError(t, errs[0], `code=400, message=failed to bind field value to int, err=strconv.ParseInt: parsing "nope": invalid syntax, field=param`)
671 assert.EqualError(t, errs[1], `code=400, message=failed to bind field value to uint, err=strconv.ParseUint: parsing "nope": invalid syntax, field=param`)
672}
673
674func TestValueBinder_Uint64_uintValue(t *testing.T) {
675 var testCases = []struct {

Callers

nothing calls this directly

Calls 6

createTestContextFunction · 0.85
QueryParamsBinderFunction · 0.85
FailFastMethod · 0.80
BindErrorsMethod · 0.80
UintMethod · 0.80
IntMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…