TestFormat_DescribeStatement verifies DESCRIBE statements are formatted correctly.
(t *testing.T)
| 153 | |
| 154 | // TestFormat_DescribeStatement verifies DESCRIBE statements are formatted correctly. |
| 155 | func 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. |
| 177 | func TestFormat_DDL_KeywordCase(t *testing.T) { |
nothing calls this directly
no test coverage detected