Skip to content

Commit

Permalink
add test coverage for handling errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Hansen committed Mar 1, 2024
1 parent 5a728de commit 84fc44e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions bind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,18 @@ func TestBindUnmarshalParam(t *testing.T) {
}
}

func TestBindUnmarshalParamInvalidInt(t *testing.T) {
e := New()
req := httptest.NewRequest(http.MethodGet, "/?ia=1,two,3", nil)
rec := httptest.NewRecorder()
c := e.NewContext(req, rec)
result := struct {
IA IntArray `query:"ia"`
}{}
err := c.Bind(&result)
assert.Error(t, err)
}

func TestBindUnmarshalText(t *testing.T) {
e := New()
req := httptest.NewRequest(http.MethodGet, "/?ts=2016-12-06T19:09:05Z&sa=one,two,three&ta=2016-12-06T19:09:05Z&ta=2016-12-06T19:09:05Z&ST=baz", nil)
Expand Down

0 comments on commit 84fc44e

Please sign in to comment.