MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestHandleParseSQL_WindowFunction

Function TestHandleParseSQL_WindowFunction

pkg/mcp/tools_test.go:477–498  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

475}
476
477func 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
500func TestHandleParseSQL_Subquery(t *testing.T) {
501 ctx := context.Background()

Callers

nothing calls this directly

Calls 5

makeReqFunction · 0.85
handleParseSQLFunction · 0.85
unmarshalResultFunction · 0.85
FatalfMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected