MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestSelect_SQL

Function TestSelect_SQL

pkg/sql/ast/sql_coverage_test.go:216–236  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

214}
215
216func TestSelect_SQL(t *testing.T) {
217 lim := int64(10)
218 off := int64(5)
219 s := &Select{
220 Distinct: true,
221 Columns: []Expression{&Identifier{Name: "a"}},
222 From: []TableReference{{Name: "t"}},
223 Where: &Identifier{Name: "true"},
224 GroupBy: []Expression{&Identifier{Name: "a"}},
225 Having: &Identifier{Name: "count(*) > 1"},
226 OrderBy: []OrderByExpression{{Expression: &Identifier{Name: "a"}, Ascending: true}},
227 Limit: &lim,
228 Offset: &off,
229 }
230 sql := s.SQL()
231 for _, want := range []string{"SELECT DISTINCT", "FROM t", "WHERE", "GROUP BY", "HAVING", "ORDER BY", "LIMIT 10", "OFFSET 5"} {
232 if !strings.Contains(sql, want) {
233 t.Errorf("missing %q in: %s", want, sql)
234 }
235 }
236}
237
238func TestInsert_SQL(t *testing.T) {
239 i := &Insert{

Callers

nothing calls this directly

Calls 2

SQLMethod · 0.95
ErrorfMethod · 0.65

Tested by

no test coverage detected