diff --git a/bittorrent/event_test.go b/bittorrent/event_test.go index 637f69b..2dc3cb7 100644 --- a/bittorrent/event_test.go +++ b/bittorrent/event_test.go @@ -3,7 +3,7 @@ package bittorrent import ( "testing" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func TestNew(t *testing.T) { @@ -23,7 +23,7 @@ func TestNew(t *testing.T) { for _, tt := range table { got, err := NewEvent(tt.data) - assert.Equal(t, err, tt.expectedErr, "errors should equal the expected value") - assert.Equal(t, got, tt.expected, "events should equal the expected value") + require.Equal(t, err, tt.expectedErr, "errors should equal the expected value") + require.Equal(t, got, tt.expected, "events should equal the expected value") } } diff --git a/frontend/http/bencode/decoder_test.go b/frontend/http/bencode/decoder_test.go index 485a47a..781f561 100644 --- a/frontend/http/bencode/decoder_test.go +++ b/frontend/http/bencode/decoder_test.go @@ -3,7 +3,7 @@ package bencode import ( "testing" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) var unmarshalTests = []struct { @@ -25,8 +25,8 @@ var unmarshalTests = []struct { func TestUnmarshal(t *testing.T) { for _, tt := range unmarshalTests { got, err := Unmarshal([]byte(tt.input)) - assert.Nil(t, err, "unmarshal should not fail") - assert.Equal(t, got, tt.expected, "unmarshalled values should match the expected results") + require.Nil(t, err, "unmarshal should not fail") + require.Equal(t, got, tt.expected, "unmarshalled values should match the expected results") } } @@ -61,8 +61,8 @@ func TestUnmarshalLarge(t *testing.T) { dec := NewDecoder(&bufferLoop{string(buf)}) got, err := dec.Decode() - assert.Nil(t, err, "decode should not fail") - assert.Equal(t, got, data, "encoding and decoding should equal the original value") + require.Nil(t, err, "decode should not fail") + require.Equal(t, got, data, "encoding and decoding should equal the original value") } func BenchmarkUnmarshalLarge(b *testing.B) { diff --git a/frontend/http/bencode/encoder_test.go b/frontend/http/bencode/encoder_test.go index 783032b..e6858b0 100644 --- a/frontend/http/bencode/encoder_test.go +++ b/frontend/http/bencode/encoder_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) var marshalTests = []struct { @@ -37,8 +37,8 @@ var marshalTests = []struct { func TestMarshal(t *testing.T) { for _, test := range marshalTests { got, err := Marshal(test.input) - assert.Nil(t, err, "marshal should not fail") - assert.Contains(t, test.expected, string(got), "the marshaled result should be one of the expected permutations") + require.Nil(t, err, "marshal should not fail") + require.Contains(t, test.expected, string(got), "the marshaled result should be one of the expected permutations") } } diff --git a/frontend/http/writer_test.go b/frontend/http/writer_test.go index fbbb9b7..155f767 100644 --- a/frontend/http/writer_test.go +++ b/frontend/http/writer_test.go @@ -4,7 +4,7 @@ import ( "net/http/httptest" "testing" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/chihaya/chihaya/bittorrent" ) @@ -20,14 +20,14 @@ func TestWriteError(t *testing.T) { for _, tt := range table { r := httptest.NewRecorder() err := WriteError(r, bittorrent.ClientError(tt.reason)) - assert.Nil(t, err) - assert.Equal(t, r.Body.String(), tt.expected) + require.Nil(t, err) + require.Equal(t, r.Body.String(), tt.expected) } } func TestWriteStatus(t *testing.T) { r := httptest.NewRecorder() err := WriteError(r, bittorrent.ClientError("something is missing")) - assert.Nil(t, err) - assert.Equal(t, r.Body.String(), "d14:failure reason20:something is missinge") + require.Nil(t, err) + require.Equal(t, r.Body.String(), "d14:failure reason20:something is missinge") }