Commit a15630df authored by Kirill Smelkov's avatar Kirill Smelkov Committed by Kamil Kisiel

tests/testEncode: Fix potential panic

Both object and objectDecodedBack are interace{}. So it could turn out,
if e.g. they are both of the same non-comparable type (e.g. []byte),
comparing them directly will panic.
parent 3ab92142
...@@ -522,7 +522,7 @@ func testEncode(t *testing.T, proto int, object, objectDecodedBack interface{}, ...@@ -522,7 +522,7 @@ func testEncode(t *testing.T, proto int, object, objectDecodedBack interface{},
} else { } else {
if !reflect.DeepEqual(v, objectDecodedBack) { if !reflect.DeepEqual(v, objectDecodedBack) {
what := "identity" what := "identity"
if object != objectDecodedBack { if !reflect.DeepEqual(object, objectDecodedBack) {
what = "expected object" what = "expected object"
} }
t.Errorf("encode -> decode != %s\nhave: %#v\nwant: %#v", what, v, objectDecodedBack) t.Errorf("encode -> decode != %s\nhave: %#v\nwant: %#v", what, v, objectDecodedBack)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment