TestFormat_ShowStatement verifies SHOW statements are formatted correctly.
(t *testing.T)
| 131 | |
| 132 | // TestFormat_ShowStatement verifies SHOW statements are formatted correctly. |
| 133 | func 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. |
| 155 | func TestFormat_DescribeStatement(t *testing.T) { |
nothing calls this directly
no test coverage detected