MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / TestErrorHandling

Function TestErrorHandling

IceFireDB-SQLite/internal/sqlite/db_test.go:227–252  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

225}
226
227func TestErrorHandling(t *testing.T) {
228 tmpFile := "/tmp/test_errors_" + time.Now().Format("20060102150405") + ".db"
229 defer os.Remove(tmpFile)
230
231 ctx := context.Background()
232 db := InitSQLite(ctx, tmpFile)
233 defer db.Close()
234
235 // Test invalid SQL
236 _, err := Exec("INVALID SQL STATEMENT")
237 if err == nil {
238 t.Error("Expected error for invalid SQL, but got none")
239 }
240
241 // Test SELECT from non-existent table
242 _, err = Exec("SELECT * FROM non_existent_table")
243 if err == nil {
244 t.Error("Expected error for non-existent table, but got none")
245 }
246
247 // Test malformed SQL
248 _, err = Exec("SELECT FROM")
249 if err == nil {
250 t.Error("Expected error for malformed SQL, but got none")
251 }
252}

Callers

nothing calls this directly

Calls 4

InitSQLiteFunction · 0.85
ExecFunction · 0.85
CloseMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected