1
0
Fork 0

Test enums

This commit is contained in:
Gregory Eremin 2018-11-09 00:05:19 +01:00
parent e86006ca42
commit f879884a1e
2 changed files with 27 additions and 0 deletions

View File

@ -51,3 +51,28 @@ func TestSet(t *testing.T) {
})
}
}
func TestEnum(t *testing.T) {
tbl := suite.createTable(mysql.ColumnTypeEnum, "'a', 'b', 'c'", attrNone)
defer tbl.drop(t)
const (
// TODO: How do I define such a bitmask properly?
bA int64 = 1
bB int64 = 2
bC int64 = 4
)
inputs := map[string]int64{
"": 0,
"a": bA,
"b": bB,
"c": bC,
}
for in, exp := range inputs {
t.Run("input "+in, func(t *testing.T) {
suite.insertAndCompareExp(t, tbl, in, exp)
})
}
}

View File

@ -158,6 +158,8 @@ func colTypeSyntax(ct mysql.ColumnType) (typName, attrs string) {
case mysql.ColumnTypeSet:
return "SET", ""
case mysql.ColumnTypeEnum:
return "ENUM", ""
case mysql.ColumnTypeJSON:
return "JSON", ""
case mysql.ColumnTypeGeometry: