Ejemplo n.º 1
0
func TestSelectCore(t *testing.T) {
	relation := nodes.Relation("table")
	core := nodes.SelectCore(relation)
	expected := `SELECT FROM "table"`
	if got, _ := sql.Accept(core); expected != got {
		t.Errorf("TestSelectCore was expected to return %s, got %s", expected, got)
	}
}
Ejemplo n.º 2
0
func TestSelectCoreExtensive(t *testing.T) {
	relation := nodes.Relation("table")
	core := nodes.SelectCore(relation)
	core.Projections = append(core.Projections, 1, 2)
	core.Wheres = append(core.Wheres, 3, 4)
	core.Source.Right = append(core.Source.Right, nodes.InnerJoin(5, nil))
	expected := `SELECT 1, 2 FROM "table" INNER JOIN 5 WHERE 3 AND 4`
	if got, _ := sql.Accept(core); expected != got {
		t.Errorf("TestSelectCoreExtensive was expected to return %s, got %s", expected, got)
	}
}