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

Function TestFormat_ShowStatement

pkg/formatter/render_ddl_test.go:133–152  ·  view source on GitHub ↗

TestFormat_ShowStatement verifies SHOW statements are formatted correctly.

(t *testing.T)

Source from the content-addressed store, hash-verified

131
132// TestFormat_ShowStatement verifies SHOW statements are formatted correctly.
133func TestFormat_ShowStatement(t *testing.T) {
134 sql := "SHOW TABLES"
135 tree, err := gosqlx.Parse(sql)
136 if err != nil {
137 t.Fatalf("Parse error: %v", err)
138 }
139 stmt, ok := tree.Statements[0].(*ast.ShowStatement)
140 if !ok {
141 t.Fatalf("expected *ast.ShowStatement, got %T", tree.Statements[0])
142 }
143 opts := ast.FormatOptions{}
144 result := formatter.FormatStatement(stmt, opts)
145 upper := strings.ToUpper(result)
146 if !strings.Contains(upper, "SHOW") {
147 t.Errorf("expected SHOW in output, got: %q", result)
148 }
149 if !strings.Contains(upper, "TABLES") {
150 t.Errorf("expected TABLES in output, got: %q", result)
151 }
152}
153
154// TestFormat_DescribeStatement verifies DESCRIBE statements are formatted correctly.
155func TestFormat_DescribeStatement(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