diff --git a/common/bytes_test.go b/common/bytes_test.go index 0c0eacc33..2ad0e692c 100644 --- a/common/bytes_test.go +++ b/common/bytes_test.go @@ -10,23 +10,20 @@ import ( // This is a trivial test for protobuf compatibility. func TestMarshal(t *testing.T) { - assert := assert.New(t) - b := []byte("hello world") dataB := Bytes(b) b2, err := dataB.Marshal() - assert.Nil(err) - assert.Equal(b, b2) + assert.Nil(t, err) + assert.Equal(t, b, b2) var dataB2 Bytes err = (&dataB2).Unmarshal(b) - assert.Nil(err) - assert.Equal(dataB, dataB2) + assert.Nil(t, err) + assert.Equal(t, dataB, dataB2) } // Test that the hex encoding works. func TestJSONMarshal(t *testing.T) { - assert := assert.New(t) type TestStruct struct { B1 []byte @@ -51,7 +48,7 @@ func TestJSONMarshal(t *testing.T) { if err != nil { t.Fatal(err) } - assert.Equal(string(jsonBytes), tc.expected) + assert.Equal(t, string(jsonBytes), tc.expected) // TODO do fuzz testing to ensure that unmarshal fails @@ -61,8 +58,8 @@ func TestJSONMarshal(t *testing.T) { if err != nil { t.Fatal(err) } - assert.Equal(ts2.B1, tc.input) - assert.Equal(ts2.B2, Bytes(tc.input)) + assert.Equal(t, ts2.B1, tc.input) + assert.Equal(t, ts2.B2, Bytes(tc.input)) }) } }