sqlboiler/bdb/table_test.go
2016-07-11 23:48:30 -07:00

67 lines
906 B
Go

package bdb
import "testing"
func TestGetTable(t *testing.T) {
t.Parallel()
tables := []Table{
{Name: "one"},
}
tbl := GetTable(tables, "one")
if tbl.Name != "one" {
t.Error("didn't get column")
}
}
func TestGetTableMissing(t *testing.T) {
t.Parallel()
tables := []Table{
{Name: "one"},
}
defer func() {
if r := recover(); r == nil {
t.Error("expected a panic failure")
}
}()
GetTable(tables, "missing")
}
func TestGetColumn(t *testing.T) {
t.Parallel()
table := Table{
Columns: []Column{
Column{Name: "one"},
},
}
c := table.GetColumn("one")
if c.Name != "one" {
t.Error("didn't get column")
}
}
func TestGetColumnMissing(t *testing.T) {
t.Parallel()
table := Table{
Columns: []Column{
Column{Name: "one"},
},
}
defer func() {
if r := recover(); r == nil {
t.Error("expected a panic failure")
}
}()
table.GetColumn("missing")
}