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

Function TestCreateIndexStatement_SQL

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

Source from the content-addressed store, hash-verified

22func covBoolPtr(v bool) *bool { return &v }
23
24func TestCreateIndexStatement_SQL(t *testing.T) {
25 stmt := &CreateIndexStatement{
26 Name: "idx_users_email",
27 Table: "users",
28 Unique: true,
29 IfNotExists: true,
30 Using: "btree",
31 Columns: []IndexColumn{{Column: "email", Direction: "ASC"}, {Column: "name"}},
32 Where: &BinaryExpression{Left: &Identifier{Name: "active"}, Operator: "=", Right: &LiteralValue{Value: "true"}},
33 }
34 sql := stmt.SQL()
35 for _, want := range []string{"CREATE UNIQUE INDEX", "IF NOT EXISTS", "idx_users_email", "ON users", "USING btree", "email ASC", "WHERE"} {
36 if !strings.Contains(sql, want) {
37 t.Errorf("SQL() missing %q, got: %s", want, sql)
38 }
39 }
40}
41
42func TestAlterTableStatement_SQL(t *testing.T) {
43 stmt := &AlterTableStatement{

Callers

nothing calls this directly

Calls 2

SQLMethod · 0.95
ErrorfMethod · 0.65

Tested by

no test coverage detected