Add zero-length slice test

This commit is contained in:
Lucas Manuel Rodriguez 2018-05-31 08:22:26 -03:00
parent 8d6d326be6
commit 140b80506d
1 changed files with 4 additions and 0 deletions

View File

@ -1593,6 +1593,10 @@ func TestInsertNilByteSlice(t *testing.T) {
if _, err := db.Exec("insert into blob_not_null (b) values (?)", nilSlice); err == nil { if _, err := db.Exec("insert into blob_not_null (b) values (?)", nilSlice); err == nil {
t.Fatal("didn't expect INSERT to 'not null' column with a nil []byte slice to work") t.Fatal("didn't expect INSERT to 'not null' column with a nil []byte slice to work")
} }
zeroLenSlice := []byte{}
if _, err := db.Exec("insert into blob_not_null (b) values (?)", zeroLenSlice); err != nil {
t.Fatal("failed to insert zero-length slice")
}
} }
var customFunctionOnce sync.Once var customFunctionOnce sync.Once