Improved TestNilAndEmptyBytes
I forgot that bytes.Equals treats nil and []byte{} as equal.
This commit is contained in:
parent
85e456ef27
commit
b1c8062c18
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue