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

Function TestHandleValidateSQL_AllDialects

pkg/mcp/tools_test.go:430–454  ·  view source on GitHub ↗

--------------------------------------------------------------------------- Edge-case tests ---------------------------------------------------------------------------

(t *testing.T)

Source from the content-addressed store, hash-verified

428// ---------------------------------------------------------------------------
429
430func 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
456func TestHandleParseSQL_CTE(t *testing.T) {
457 ctx := context.Background()

Callers

nothing calls this directly

Calls 6

makeReqFunction · 0.85
handleValidateSQLFunction · 0.85
unmarshalResultFunction · 0.85
RunMethod · 0.80
FatalfMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected