(t *testing.T)
| 657 | } |
| 658 | |
| 659 | func 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 | |
| 674 | func TestValueBinder_Uint64_uintValue(t *testing.T) { |
| 675 | var testCases = []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…