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)
| 96 | // |
| 97 | // testing.RequireInvalidSQL(t, "SELECT FROM WHERE") |
| 98 | func 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. |