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

Function TestAssertFormattedSQL_NotMatching

pkg/gosqlx/testing/testing_test.go:155–171  ·  view source on GitHub ↗

Test AssertFormattedSQL with non-matching format

(t *testing.T)

Source from the content-addressed store, hash-verified

153
154// Test AssertFormattedSQL with non-matching format
155func TestAssertFormattedSQL_NotMatching(t *testing.T) {
156 mockT := &mockTestingT{}
157
158 sql := "SELECT * FROM users"
159 expected := "SELECT * FROM orders"
160 result := AssertFormattedSQL(mockT, sql, expected)
161
162 if result {
163 t.Error("AssertFormattedSQL should return false for non-matching format")
164 }
165 if !mockT.failed {
166 t.Error("AssertFormattedSQL should fail for non-matching format")
167 }
168 if !strings.Contains(mockT.errorMsg, "does not match expected") {
169 t.Errorf("Error message should be descriptive, got: %s", mockT.errorMsg)
170 }
171}
172
173// Test AssertFormattedSQL with invalid SQL
174func TestAssertFormattedSQL_InvalidSQL(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