Fix non-bundled tests against macOS system SQLite

This commit is contained in:
Thom Chiovoloni
2022-04-03 10:48:56 -07:00
parent f8b9ad8907
commit 9699b4a210
3 changed files with 35 additions and 21 deletions

View File

@@ -5,17 +5,16 @@ use rusqlite::ffi;
use rusqlite::Connection;
#[test]
#[should_panic]
fn test_error_when_singlethread_mode() {
// put SQLite into single-threaded mode
unsafe {
// Note: macOS system SQLite seems to return an error if you attempt to
// reconfigure to single-threaded mode.
if ffi::sqlite3_config(ffi::SQLITE_CONFIG_SINGLETHREAD) != ffi::SQLITE_OK {
return;
}
if ffi::sqlite3_initialize() != ffi::SQLITE_OK {
return;
}
assert_eq!(ffi::sqlite3_initialize(), ffi::SQLITE_OK);
}
let _ = Connection::open_in_memory().unwrap();
let res = Connection::open_in_memory();
assert!(res.is_err());
}