Use !bytes.Equal(x,y), not bytes.Compare(x,y)!=0

This commit is contained in:
Alexander A. Klimov 2021-05-28 14:06:33 +02:00
parent a4abdce1f0
commit 1329c68cf3

View file

@ -158,8 +158,8 @@ func assertPackAny(t *testing.T, in interface{}, out []byte) {
{
buf := &bytes.Buffer{}
if err := PackAny(in, buf); err == nil {
if bytes.Compare(buf.Bytes(), out) != 0 {
t.Errorf("buf := &bytes.Buffer{}; packAny(%#v, buf); bytes.Compare(buf.Bytes(), %#v) != 0", in, out)
if !bytes.Equal(buf.Bytes(), out) {
t.Errorf("buf := &bytes.Buffer{}; packAny(%#v, buf); !bytes.Equal(buf.Bytes(), %#v)", in, out)
}
} else {
t.Errorf("packAny(%#v, &bytes.Buffer{}) != nil", in)