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

Function TestCreateTableStatementSQL

pkg/sql/ast/sql_test.go:181–194  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

179}
180
181func TestCreateTableStatementSQL(t *testing.T) {
182 stmt := &CreateTableStatement{
183 Name: "users",
184 Columns: []ColumnDef{
185 {Name: "id", Type: "INTEGER", Constraints: []ColumnConstraint{{Type: "PRIMARY KEY"}}},
186 {Name: "name", Type: "VARCHAR(255)", Constraints: []ColumnConstraint{{Type: "NOT NULL"}}},
187 {Name: "email", Type: "VARCHAR(255)", Constraints: []ColumnConstraint{{Type: "UNIQUE"}}},
188 },
189 }
190 want := "CREATE TABLE users (id INTEGER PRIMARY KEY, name VARCHAR(255) NOT NULL, email VARCHAR(255) UNIQUE)"
191 if got := stmt.SQL(); got != want {
192 t.Errorf("SQL() =\n %s\nwant:\n %s", got, want)
193 }
194}
195
196func TestExpressionSQL(t *testing.T) {
197 tests := []struct {

Callers

nothing calls this directly

Calls 2

SQLMethod · 0.95
ErrorfMethod · 0.65

Tested by

no test coverage detected