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

Function TestValidateSQLInternal_InvalidGeneric

pkg/mcp/tools_internal_test.go:43–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

41}
42
43func TestValidateSQLInternal_InvalidGeneric(t *testing.T) {
44 data, err := validateSQLInternal("SELECT FROM", "")
45 if err != nil {
46 t.Fatalf("expected nil error for invalid SQL (tool-semantic), got: %v", err)
47 }
48 if data["valid"] != false {
49 t.Errorf("expected valid=false, got %v", data["valid"])
50 }
51 if _, ok := data["error"]; !ok {
52 t.Error("expected error key in result")
53 }
54}
55
56func TestValidateSQLInternal_ValidWithDialect(t *testing.T) {
57 data, err := validateSQLInternal("SELECT 1", "postgresql")

Callers

nothing calls this directly

Calls 4

validateSQLInternalFunction · 0.85
FatalfMethod · 0.65
ErrorfMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected