diff options
author | Greg Holt <gregory.holt@gmail.com> | 2017-08-21 13:45:34 -0700 |
---|---|---|
committer | Greg Holt <gregory.holt@gmail.com> | 2017-08-21 13:46:00 -0700 |
commit | b1c8062c18ee31834bdd0cd70c90af8590ce1f1a (patch) | |
tree | cbc91e77b2908af25c7d2456488c586fdfdbf753 /sqlite3_test.go | |
parent | Fix to pass TestNilAndEmptyBytes (diff) | |
download | golite-b1c8062c18ee31834bdd0cd70c90af8590ce1f1a.tar.gz golite-b1c8062c18ee31834bdd0cd70c90af8590ce1f1a.tar.xz |
Improved TestNilAndEmptyBytes
I forgot that bytes.Equals treats nil and []byte{} as equal.
Diffstat (limited to 'sqlite3_test.go')
-rw-r--r-- | sqlite3_test.go | 4 |
1 files changed, 3 insertions, 1 deletions
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) } } |