Skip to content

Commit

Permalink
Simplify TestXPanicsInvariant test functions
Browse files Browse the repository at this point in the history
  • Loading branch information
tmthrgd committed Apr 14, 2018
1 parent 7ab0448 commit b692657
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions gzip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -646,22 +646,18 @@ func TestReleaseBufferPanicsInvaraiant(t *testing.T) {

func TestWritePanicsInvariant(t *testing.T) {
assert.PanicsWithValue(t, "gziphandler: both buf and gw are non nil in call to Write", func() {
var gw gzip.Writer
var buf []byte
(&responseWriter{
gw: &gw,
buf: &buf,
gw: new(gzip.Writer),
buf: new([]byte),
}).Write(nil)
}, "Write did not panic with both gw and buf non-nil")
}

func TestClosePanicsInvariant(t *testing.T) {
assert.PanicsWithValue(t, "gziphandler: both buf and gw are non nil in call to Close", func() {
var gw gzip.Writer
var buf []byte
(&responseWriter{
gw: &gw,
buf: &buf,
gw: new(gzip.Writer),
buf: new([]byte),
}).Close()
}, "Close did not panic with both gw and buf non-nil")
}
Expand Down

0 comments on commit b692657

Please sign in to comment.