mirror of
https://github.com/isar/rusqlite.git
synced 2025-10-18 22:09:05 +08:00
Make tests return Result
This commit is contained in:
@@ -106,11 +106,11 @@ mod test {
|
||||
use std::time;
|
||||
|
||||
#[test]
|
||||
fn test_unlock_notify() {
|
||||
fn test_unlock_notify() -> Result<()> {
|
||||
let url = "file::memory:?cache=shared";
|
||||
let flags = OpenFlags::SQLITE_OPEN_READ_WRITE | OpenFlags::SQLITE_OPEN_URI;
|
||||
let db1 = Connection::open_with_flags(url, flags).unwrap();
|
||||
db1.execute_batch("CREATE TABLE foo (x)").unwrap();
|
||||
let db1 = Connection::open_with_flags(url, flags)?;
|
||||
db1.execute_batch("CREATE TABLE foo (x)")?;
|
||||
let (rx, tx) = sync_channel(0);
|
||||
let child = thread::spawn(move || {
|
||||
let mut db2 = Connection::open_with_flags(url, flags).unwrap();
|
||||
@@ -123,7 +123,8 @@ mod test {
|
||||
});
|
||||
assert_eq!(tx.recv().unwrap(), 1);
|
||||
let the_answer: Result<i64> = db1.query_row("SELECT x FROM foo", [], |r| r.get(0));
|
||||
assert_eq!(42i64, the_answer.unwrap());
|
||||
assert_eq!(42i64, the_answer?);
|
||||
child.join().unwrap();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user