| 517 | } |
| 518 | |
| 519 | func TestMainInvalidQuery(t *testing.T) { |
| 520 | os.Stderr = nil |
| 521 | |
| 522 | err := cmd([]string{ |
| 523 | "--db", |
| 524 | testDbPath, |
| 525 | "--query", |
| 526 | "BANANA * FROM ip_dns WHERE dns = ?", |
| 527 | }) |
| 528 | if err == nil { |
| 529 | t.Fatal(`Should throw an error`) |
| 530 | } |
| 531 | if err == nil || !strings.Contains(err.Error(), "syntax error") { |
| 532 | t.Fatalf(`Should throw a 'syntax error' error: %v`, err) |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | func TestCountParamsZero(t *testing.T) { |
| 537 | db, err := sql.Open("sqlite3", fmt.Sprintf("file:%s?mode=rw&cache=shared&_journal_mode=WAL", testDbPath)) |