mirror of
https://github.com/fluencelabs/sqlite-wasm-connector
synced 2025-06-25 21:11:32 +00:00
Test opening a read-only connection
This commit is contained in:
18
tests/lib.rs
18
tests/lib.rs
@ -1,7 +1,7 @@
|
||||
extern crate sqlite;
|
||||
extern crate temporary;
|
||||
|
||||
use sqlite::{Connection, State, Type, Value};
|
||||
use sqlite::{Connection, ConnectionFlags, State, Type, Value};
|
||||
use std::path::Path;
|
||||
|
||||
macro_rules! ok(($result:expr) => ($result.unwrap()));
|
||||
@ -40,6 +40,22 @@ fn connection_iterate() {
|
||||
assert!(done);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn connection_open_with_flags() {
|
||||
use temporary::Directory;
|
||||
|
||||
let directory = ok!(Directory::new("sqlite"));
|
||||
let path = directory.path().join("database.sqlite3");
|
||||
setup_users(&path);
|
||||
|
||||
let flags = ConnectionFlags::new().set_read_only();
|
||||
let connection = ok!(sqlite::open_with_flags(path, flags));
|
||||
match connection.execute("INSERT INTO users VALUES (2, 'Bob', NULL, NULL)") {
|
||||
Err(_) => {},
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn connection_set_busy_handler() {
|
||||
use std::thread;
|
||||
|
Reference in New Issue
Block a user