(t *testing.T)
| 225 | } |
| 226 | |
| 227 | func 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 | } |
nothing calls this directly
no test coverage detected