TestConvertStatement tests statement conversion
(t *testing.T)
| 293 | |
| 294 | // TestConvertStatement tests statement conversion |
| 295 | func TestConvertStatement(t *testing.T) { |
| 296 | // Test with a simple SELECT statement |
| 297 | var outBuf, errBuf bytes.Buffer |
| 298 | parser := NewParser(&outBuf, &errBuf, CLIParserOptions{Format: "table"}) |
| 299 | |
| 300 | result, err := parser.Parse("SELECT * FROM users WHERE active = true") |
| 301 | if err != nil { |
| 302 | t.Fatalf("Failed to parse: %v", err) |
| 303 | } |
| 304 | defer ast.ReleaseAST(result.AST) |
| 305 | |
| 306 | if len(result.AST.Statements) == 0 { |
| 307 | t.Fatal("Expected at least one statement") |
| 308 | } |
| 309 | |
| 310 | display := convertStatement(result.AST.Statements[0]) |
| 311 | |
| 312 | if display.Type == "" { |
| 313 | t.Error("Expected type to be set") |
| 314 | } |
| 315 | |
| 316 | // Should have details for SELECT statement |
| 317 | if display.Details == nil { |
| 318 | t.Error("Expected details for SELECT statement") |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | // TestParserOptionsFromConfig tests configuration merging |
| 323 | func TestParserOptionsFromConfig(t *testing.T) { |
nothing calls this directly
no test coverage detected