--------------------------------------------------------------------------- Edge-case tests ---------------------------------------------------------------------------
(t *testing.T)
| 428 | // --------------------------------------------------------------------------- |
| 429 | |
| 430 | func TestHandleValidateSQL_AllDialects(t *testing.T) { |
| 431 | ctx := context.Background() |
| 432 | dialects := []string{"generic", "mysql", "postgresql", "sqlite", "sqlserver", "oracle", "snowflake"} |
| 433 | |
| 434 | for _, dialect := range dialects { |
| 435 | t.Run(dialect, func(t *testing.T) { |
| 436 | req := makeReq(map[string]any{ |
| 437 | "sql": "SELECT 1", |
| 438 | "dialect": dialect, |
| 439 | }) |
| 440 | res, err := handleValidateSQL(ctx, req) |
| 441 | if err != nil { |
| 442 | t.Fatalf("unexpected error for dialect %s: %v", dialect, err) |
| 443 | } |
| 444 | data := unmarshalResult(t, res) |
| 445 | valid, ok := data["valid"].(bool) |
| 446 | if !ok || !valid { |
| 447 | t.Errorf("expected valid=true for dialect %s, got %v", dialect, data["valid"]) |
| 448 | } |
| 449 | if data["dialect"] != dialect { |
| 450 | t.Errorf("expected dialect=%s, got %v", dialect, data["dialect"]) |
| 451 | } |
| 452 | }) |
| 453 | } |
| 454 | } |
| 455 | |
| 456 | func TestHandleParseSQL_CTE(t *testing.T) { |
| 457 | ctx := context.Background() |
nothing calls this directly
no test coverage detected