Skip to content

Commit

Permalink
Add a test for RAISE
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanUkhov committed Mar 10, 2024
1 parent 28b5be5 commit df377a7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
3 changes: 0 additions & 3 deletions tests/connection.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
extern crate sqlite;
extern crate temporary;

use sqlite::{Connection, OpenFlags, State};

mod common;
Expand Down
15 changes: 12 additions & 3 deletions tests/cursor.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
extern crate sqlite;

use sqlite::{Type, Value};
use std::collections::HashMap;

use sqlite::{Result, Type, Value};

mod common;

use common::{setup_english, setup_users};
Expand Down Expand Up @@ -91,6 +90,16 @@ fn iter_count() {
assert_eq!(statement.iter().filter(|row| row.is_ok()).count(), 6);
}

#[test]
fn iter_count_with_exception() {
let connection = ok!(sqlite::open(":memory:"));
ok!(connection.execute("CREATE TABLE foo(x)"));
ok!(connection
.execute("CREATE TRIGGER bar BEFORE INSERT ON foo BEGIN SELECT RAISE(FAIL, 'buz'); END"));
let mut statement = ok!(connection.prepare("INSERT INTO foo VALUES (0) RETURNING rowid;"));
assert!(statement.iter().collect::<Result<Vec<_>>>().is_err());
}

#[test]
fn next_index() {
let connection = setup_users(":memory:");
Expand Down
2 changes: 0 additions & 2 deletions tests/statement.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
extern crate sqlite;

use sqlite::{Connection, State, Statement, Type, Value};

mod common;
Expand Down

0 comments on commit df377a7

Please sign in to comment.