Skip to content

Commit

Permalink
improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
efectn committed Dec 23, 2024
1 parent e2e93a4 commit 47a8f32
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions binder/cbor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ func Test_CBORBinder_Bind(t *testing.T) {
require.Equal(t, "post3", user.Posts[2].Title)
require.Contains(t, user.Names, "john")
require.Contains(t, user.Names, "doe")

b.Reset()
require.Nil(t, b.CBORDecoder)
}

func Benchmark_CBORBinder_Bind(b *testing.B) {
Expand Down
3 changes: 3 additions & 0 deletions binder/cookie_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ func Test_CookieBinder_Bind(t *testing.T) {
require.Equal(t, 42, user.Age)
require.Contains(t, user.Names, "john")
require.Contains(t, user.Names, "doe")

b.Reset()
require.False(t, b.EnableSplitting)
}

func Benchmark_CookieBinder_Bind(b *testing.B) {
Expand Down
3 changes: 3 additions & 0 deletions binder/form_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ func Test_FormBinder_Bind(t *testing.T) {
require.Equal(t, "post3", user.Posts[2].Title)
require.Contains(t, user.Names, "john")
require.Contains(t, user.Names, "doe")

b.Reset()
require.False(t, b.EnableSplitting)
}

func Benchmark_FormBinder_Bind(b *testing.B) {
Expand Down
3 changes: 3 additions & 0 deletions binder/header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ func Test_HeaderBinder_Bind(t *testing.T) {
require.Equal(t, "post3", user.Posts[2])
require.Contains(t, user.Names, "john")
require.Contains(t, user.Names, "doe")

b.Reset()
require.False(t, b.EnableSplitting)
}

func Benchmark_HeaderBinder_Bind(b *testing.B) {
Expand Down
3 changes: 3 additions & 0 deletions binder/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ func Test_JSON_Binding_Bind(t *testing.T) {
require.Equal(t, "post1", user.Posts[0].Title)
require.Equal(t, "post2", user.Posts[1].Title)
require.Equal(t, "post3", user.Posts[2].Title)

b.Reset()
require.Nil(t, b.JSONDecoder)
}

func Benchmark_JSON_Binding_Bind(b *testing.B) {
Expand Down
3 changes: 3 additions & 0 deletions binder/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ func Test_QueryBinder_Bind(t *testing.T) {
require.Equal(t, "post3", user.Posts[2].Title)
require.Contains(t, user.Names, "john")
require.Contains(t, user.Names, "doe")

b.Reset()
require.False(t, b.EnableSplitting)
}

func Benchmark_QueryBinder_Bind(b *testing.B) {
Expand Down
3 changes: 3 additions & 0 deletions binder/resp_header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ func Test_RespHeaderBinder_Bind(t *testing.T) {
require.Equal(t, "john", user.Name)
require.Equal(t, 42, user.Age)
require.Equal(t, []string{"post1", "post2", "post3"}, user.Posts)

b.Reset()
require.False(t, b.EnableSplitting)
}

func Benchmark_RespHeaderBinder_Bind(b *testing.B) {
Expand Down
2 changes: 2 additions & 0 deletions binder/uri_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ func Test_URIBinding_Bind(t *testing.T) {
require.Equal(t, "john", user.Name)
require.Equal(t, 42, user.Age)
require.Equal(t, []string{"post1,post2,post3"}, user.Posts)

b.Reset()
}

func Benchmark_URIBinding_Bind(b *testing.B) {
Expand Down
3 changes: 3 additions & 0 deletions binder/xml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ func Test_XMLBinding_Bind(t *testing.T) {
require.Len(t, user.Posts, 2)
require.Equal(t, "post1", user.Posts[0].Title)
require.Equal(t, "post2", user.Posts[1].Title)

b.Reset()
require.Nil(t, b.XMLDecoder)
}

func Test_XMLBinding_Bind_error(t *testing.T) {
Expand Down

0 comments on commit 47a8f32

Please sign in to comment.