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

Function TestFormat_DescribeStatement

pkg/formatter/render_ddl_test.go:155–174  ·  view source on GitHub ↗

TestFormat_DescribeStatement verifies DESCRIBE statements are formatted correctly.

(t *testing.T)

Source from the content-addressed store, hash-verified

153
154// TestFormat_DescribeStatement verifies DESCRIBE statements are formatted correctly.
155func TestFormat_DescribeStatement(t *testing.T) {
156 sql := "DESCRIBE users"
157 tree, err := gosqlx.Parse(sql)
158 if err != nil {
159 t.Fatalf("Parse error: %v", err)
160 }
161 stmt, ok := tree.Statements[0].(*ast.DescribeStatement)
162 if !ok {
163 t.Fatalf("expected *ast.DescribeStatement, got %T", tree.Statements[0])
164 }
165 opts := ast.FormatOptions{}
166 result := formatter.FormatStatement(stmt, opts)
167 upper := strings.ToUpper(result)
168 if !strings.Contains(upper, "DESCRIBE") {
169 t.Errorf("expected DESCRIBE in output, got: %q", result)
170 }
171 if !strings.Contains(result, "users") {
172 t.Errorf("expected table name 'users' in output, got: %q", result)
173 }
174}
175
176// TestFormat_DDL_KeywordCase verifies that DDL formatter respects keyword casing options.
177func TestFormat_DDL_KeywordCase(t *testing.T) {

Callers

nothing calls this directly

Calls 4

ParseFunction · 0.92
FormatStatementFunction · 0.92
FatalfMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected