1
0
Fork 0
bocadillo/tests/type_null_test.go

25 lines
463 B
Go

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)
})
}
}