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

Function TestLintSQLInternal_WithViolations

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

Source from the content-addressed store, hash-verified

317}
318
319func TestLintSQLInternal_WithViolations(t *testing.T) {
320 data, err := lintSQLInternal("select id from users \n")
321 if err != nil {
322 t.Fatalf("unexpected error: %v", err)
323 }
324 violations, ok := data["violations"].([]map[string]any)
325 if !ok {
326 t.Fatal("expected violations to be []map[string]any")
327 }
328 if len(violations) == 0 {
329 t.Error("expected lint violations for trailing whitespace / keyword case")
330 }
331 v := violations[0]
332 for _, key := range []string{"rule", "rule_name", "severity", "message", "line", "column", "suggestion"} {
333 if _, ok := v[key]; !ok {
334 t.Errorf("violation missing key %q", key)
335 }
336 }
337}
338
339// --- toolResult ---
340

Callers

nothing calls this directly

Calls 4

lintSQLInternalFunction · 0.85
FatalfMethod · 0.65
ErrorfMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected