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

Function TestAssertFormattedSQL_InvalidSQL

pkg/gosqlx/testing/testing_test.go:174–188  ·  view source on GitHub ↗

Test AssertFormattedSQL with invalid SQL

(t *testing.T)

Source from the content-addressed store, hash-verified

172
173// Test AssertFormattedSQL with invalid SQL
174func TestAssertFormattedSQL_InvalidSQL(t *testing.T) {
175 mockT := &mockTestingT{}
176
177 result := AssertFormattedSQL(mockT, "SELECT FROM WHERE", "anything")
178
179 if result {
180 t.Error("AssertFormattedSQL should return false for invalid SQL")
181 }
182 if !mockT.failed {
183 t.Error("AssertFormattedSQL should fail for invalid SQL")
184 }
185 if !strings.Contains(mockT.errorMsg, "Failed to format SQL") {
186 t.Errorf("Error message should indicate format failure, got: %s", mockT.errorMsg)
187 }
188}
189
190// Test AssertTables with correct tables
191func TestAssertTables_Correct(t *testing.T) {

Callers

nothing calls this directly

Calls 3

AssertFormattedSQLFunction · 0.85
ErrorfMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected