diff --git a/bytes/seekable/seekable_test.go b/bytes/seekable/seekable_test.go index 98d97f9..15d49bd 100644 --- a/bytes/seekable/seekable_test.go +++ b/bytes/seekable/seekable_test.go @@ -4,40 +4,50 @@ import ( "bytes" "net/http" "testing" - - "github.com/stretchr/testify/assert" ) +func assertEqual(t *testing.T, a, b interface{}) { + if a != b { + t.Fatal("assertEqual:", a, b) + } +} + +func assertNoError(t *testing.T, err error) { + if err != nil { + t.Fatal("assertNoError:", err) + } +} + func TestSeekable_EOFIfReqAlreadyParsed(t *testing.T) { body := "a=1" req, err := http.NewRequest("POST", "/a", bytes.NewBufferString(body)) - assert.NoError(t, err) + assertNoError(t, err) req.Header.Set("Content-Type", "application/x-www-form-urlencoded") req.Header.Set("Content-Length", "3") req.ParseForm() _, err = New(req) - assert.Equal(t, err.Error(), "EOF") + assertEqual(t, err.Error(), "EOF") } func TestSeekable_WorkaroundForEOF(t *testing.T) { body := "a=1" req, err := http.NewRequest("POST", "/a", bytes.NewBufferString(body)) - assert.NoError(t, err) + assertNoError(t, err) req.Header.Set("Content-Type", "application/x-www-form-urlencoded") req.Header.Set("Content-Length", "3") _, _ = New(req) req.ParseForm() - assert.Equal(t, req.FormValue("a"), "1") + assertEqual(t, req.FormValue("a"), "1") _, err = New(req) - assert.NoError(t, err) + assertNoError(t, err) } func TestSeekable(t *testing.T) { body := "a=1" req, err := http.NewRequest("POST", "/a", bytes.NewBufferString(body)) - assert.NoError(t, err) + assertNoError(t, err) req.Header.Set("Content-Type", "application/x-www-form-urlencoded") req.Header.Set("Content-Length", "3") _, err = New(req) - assert.NoError(t, err) + assertNoError(t, err) }