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

Function TestAssertValidSQL_Invalid

pkg/gosqlx/testing/testing_test.go:40–54  ·  view source on GitHub ↗

Test AssertValidSQL with invalid SQL

(t *testing.T)

Source from the content-addressed store, hash-verified

38
39// Test AssertValidSQL with invalid SQL
40func TestAssertValidSQL_Invalid(t *testing.T) {
41 mockT := &mockTestingT{}
42
43 result := AssertValidSQL(mockT, "SELECT FROM WHERE")
44
45 if result {
46 t.Error("AssertValidSQL should return false for invalid SQL")
47 }
48 if !mockT.failed {
49 t.Error("AssertValidSQL should fail for invalid SQL")
50 }
51 if !strings.Contains(mockT.errorMsg, "Expected valid SQL") {
52 t.Errorf("Error message should be descriptive, got: %s", mockT.errorMsg)
53 }
54}
55
56// Test AssertInvalidSQL with invalid SQL
57func TestAssertInvalidSQL_Invalid(t *testing.T) {

Callers

nothing calls this directly

Calls 3

AssertValidSQLFunction · 0.85
ErrorfMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected