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

Function RequireInvalidSQL

pkg/gosqlx/testing/testing.go:98–106  ·  view source on GitHub ↗

RequireInvalidSQL requires that the given SQL is syntactically invalid. If the SQL is valid, the test stops immediately. Example: testing.RequireInvalidSQL(t, "SELECT FROM WHERE")

(t TestingT, sql string)

Source from the content-addressed store, hash-verified

96//
97// testing.RequireInvalidSQL(t, "SELECT FROM WHERE")
98func RequireInvalidSQL(t TestingT, sql string) {
99 t.Helper()
100
101 err := gosqlx.Validate(sql)
102 if err == nil {
103 t.Fatalf("Required invalid SQL, but it parsed successfully:\n SQL: %s",
104 truncateSQL(sql))
105 }
106}
107
108// AssertFormattedSQL asserts that the SQL formats to match the expected output.
109// This validates both that the SQL is valid and that it formats correctly.

Callers 2

Calls 4

ValidateFunction · 0.92
truncateSQLFunction · 0.85
HelperMethod · 0.65
FatalfMethod · 0.65

Tested by 2