1
0
Fork 0

Null tests

This commit is contained in:
Gregory Eremin 2018-11-08 20:49:04 +01:00
parent f6fcf11dd0
commit 6a6b8b785a
1 changed files with 24 additions and 0 deletions

24
tests/null_test.go Normal file
View File

@ -0,0 +1,24 @@
package tests
import (
"fmt"
"testing"
"github.com/localhots/bocadillo/mysql"
)
func TestNull(t *testing.T) {
tbl := suite.createTable(mysql.ColumnTypeTiny, "", attrUnsigned|attrAllowNull)
defer tbl.drop(t)
uint8p := func(v uint8) *uint8 { return &v }
for _, v := range []*uint8{uint8p(0), uint8p(1), nil} {
strv := "NULL"
if v != nil {
strv = fmt.Sprint(*v)
}
t.Run(strv, func(t *testing.T) {
suite.insertAndCompare(t, tbl, v)
})
}
}