(t *testing.T)
| 42 | } |
| 43 | |
| 44 | func TestBindingError_Error(t *testing.T) { |
| 45 | err := NewBindingError("id", []string{"1", "nope"}, "bind failed", errors.New("internal error")) |
| 46 | assert.EqualError(t, err, `code=400, message=bind failed, err=internal error, field=id`) |
| 47 | |
| 48 | bErr := err.(*BindingError) |
| 49 | assert.Equal(t, 400, bErr.Code) |
| 50 | assert.Equal(t, "bind failed", bErr.Message) |
| 51 | assert.Equal(t, errors.New("internal error"), bErr.err) |
| 52 | |
| 53 | assert.Equal(t, "id", bErr.Field) |
| 54 | assert.Equal(t, []string{"1", "nope"}, bErr.Values) |
| 55 | } |
| 56 | |
| 57 | func TestBindingError_ErrorJSON(t *testing.T) { |
| 58 | err := NewBindingError("id", []string{"1", "nope"}, "bind failed", errors.New("internal error")) |
nothing calls this directly
no test coverage detected
searching dependent graphs…