(t *testing.T)
| 475 | } |
| 476 | |
| 477 | func TestHandleParseSQL_WindowFunction(t *testing.T) { |
| 478 | ctx := context.Background() |
| 479 | req := makeReq(map[string]any{ |
| 480 | "sql": "SELECT ROW_NUMBER() OVER(PARTITION BY dept ORDER BY salary DESC) FROM employees", |
| 481 | }) |
| 482 | res, err := handleParseSQL(ctx, req) |
| 483 | if err != nil { |
| 484 | t.Fatalf("unexpected error: %v", err) |
| 485 | } |
| 486 | data := unmarshalResult(t, res) |
| 487 | count, ok := data["statement_count"].(float64) |
| 488 | if !ok || count != 1 { |
| 489 | t.Errorf("expected statement_count=1, got %v", data["statement_count"]) |
| 490 | } |
| 491 | types, ok := data["statement_types"].([]any) |
| 492 | if !ok || len(types) == 0 { |
| 493 | t.Fatalf("expected non-empty statement_types, got %v", data["statement_types"]) |
| 494 | } |
| 495 | if types[0] != "*ast.SelectStatement" { |
| 496 | t.Errorf("expected *ast.SelectStatement, got %v", types[0]) |
| 497 | } |
| 498 | } |
| 499 | |
| 500 | func TestHandleParseSQL_Subquery(t *testing.T) { |
| 501 | ctx := context.Background() |
nothing calls this directly
no test coverage detected