From b1c8062c18ee31834bdd0cd70c90af8590ce1f1a Mon Sep 17 00:00:00 2001 From: Greg Holt Date: Mon, 21 Aug 2017 13:45:34 -0700 Subject: [PATCH] Improved TestNilAndEmptyBytes I forgot that bytes.Equals treats nil and []byte{} as equal. --- sqlite3_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sqlite3_test.go b/sqlite3_test.go index 8169f3d..09e6727 100644 --- a/sqlite3_test.go +++ b/sqlite3_test.go @@ -1391,7 +1391,9 @@ func TestNilAndEmptyBytes(t *testing.T) { if err = rows.Err(); err != nil { t.Fatal(tst.name, err) } - if !bytes.Equal(scanBytes, tst.expectedBytes) { + if tst.expectedBytes == nil && scanBytes != nil { + t.Errorf("%s: %#v != %#v", tst.name, scanBytes, tst.expectedBytes) + } else if !bytes.Equal(scanBytes, tst.expectedBytes) { t.Errorf("%s: %#v != %#v", tst.name, scanBytes, tst.expectedBytes) } }