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

Function TestHandleParseSQL_CTE

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

Source from the content-addressed store, hash-verified

454}
455
456func TestHandleParseSQL_CTE(t *testing.T) {
457 ctx := context.Background()
458 req := makeReq(map[string]any{"sql": "WITH cte AS (SELECT 1) SELECT * FROM cte"})
459 res, err := handleParseSQL(ctx, req)
460 if err != nil {
461 t.Fatalf("unexpected error: %v", err)
462 }
463 data := unmarshalResult(t, res)
464 count, ok := data["statement_count"].(float64)
465 if !ok || count != 1 {
466 t.Errorf("expected statement_count=1, got %v", data["statement_count"])
467 }
468 types, ok := data["statement_types"].([]any)
469 if !ok || len(types) == 0 {
470 t.Fatalf("expected non-empty statement_types, got %v", data["statement_types"])
471 }
472 if types[0] != "*ast.SelectStatement" {
473 t.Errorf("expected *ast.SelectStatement, got %v", types[0])
474 }
475}
476
477func TestHandleParseSQL_WindowFunction(t *testing.T) {
478 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