mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-21 17:01:35 +00:00
Do not shadow assert
This commit is contained in:
@ -10,23 +10,20 @@ import (
|
|||||||
|
|
||||||
// This is a trivial test for protobuf compatibility.
|
// This is a trivial test for protobuf compatibility.
|
||||||
func TestMarshal(t *testing.T) {
|
func TestMarshal(t *testing.T) {
|
||||||
assert := assert.New(t)
|
|
||||||
|
|
||||||
b := []byte("hello world")
|
b := []byte("hello world")
|
||||||
dataB := Bytes(b)
|
dataB := Bytes(b)
|
||||||
b2, err := dataB.Marshal()
|
b2, err := dataB.Marshal()
|
||||||
assert.Nil(err)
|
assert.Nil(t, err)
|
||||||
assert.Equal(b, b2)
|
assert.Equal(t, b, b2)
|
||||||
|
|
||||||
var dataB2 Bytes
|
var dataB2 Bytes
|
||||||
err = (&dataB2).Unmarshal(b)
|
err = (&dataB2).Unmarshal(b)
|
||||||
assert.Nil(err)
|
assert.Nil(t, err)
|
||||||
assert.Equal(dataB, dataB2)
|
assert.Equal(t, dataB, dataB2)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that the hex encoding works.
|
// Test that the hex encoding works.
|
||||||
func TestJSONMarshal(t *testing.T) {
|
func TestJSONMarshal(t *testing.T) {
|
||||||
assert := assert.New(t)
|
|
||||||
|
|
||||||
type TestStruct struct {
|
type TestStruct struct {
|
||||||
B1 []byte
|
B1 []byte
|
||||||
@ -51,7 +48,7 @@ func TestJSONMarshal(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
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
|
// TODO do fuzz testing to ensure that unmarshal fails
|
||||||
|
|
||||||
@ -61,8 +58,8 @@ func TestJSONMarshal(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
assert.Equal(ts2.B1, tc.input)
|
assert.Equal(t, ts2.B1, tc.input)
|
||||||
assert.Equal(ts2.B2, Bytes(tc.input))
|
assert.Equal(t, ts2.B2, Bytes(tc.input))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user