added test to sql/types

This commit is contained in:
Shlomi Noach 2016-10-13 13:13:00 +02:00
parent 882959ba83
commit 661b7ff0c1

View File

@ -28,3 +28,17 @@ func TestParseColumnList(t *testing.T) {
test.S(t).ExpectEquals(columnList.Ordinals["category"], 1)
test.S(t).ExpectEquals(columnList.Ordinals["max_len"], 2)
}
func TestGetColumn(t *testing.T) {
names := "id,category,max_len"
columnList := ParseColumnList(names)
{
column := columnList.GetColumn("category")
test.S(t).ExpectTrue(column != nil)
test.S(t).ExpectEquals(column.Name, "category")
}
{
column := columnList.GetColumn("no_such_column")
test.S(t).ExpectTrue(column == nil)
}
}