From b6926571cf3e61efcd15fbc9f32e8e7944ab47e8 Mon Sep 17 00:00:00 2001 From: Tom Thorogood Date: Sat, 14 Apr 2018 15:51:26 +0930 Subject: [PATCH] Simplify TestXPanicsInvariant test functions --- gzip_test.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/gzip_test.go b/gzip_test.go index 1895383..ec0602b 100644 --- a/gzip_test.go +++ b/gzip_test.go @@ -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") }