mirror of
https://github.com/fluencelabs/sqlite-wasm-connector
synced 2025-03-15 06:20:50 +00:00
Clean up the unit tests
This commit is contained in:
parent
02f8c79c9f
commit
b433054c82
@ -154,12 +154,10 @@ extern fn process_callback<F>(callback: *mut c_void, count: c_int, values: *mut
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::Connection;
|
||||
use tests::setup;
|
||||
|
||||
#[test]
|
||||
fn execute() {
|
||||
let (path, _directory) = setup();
|
||||
let connection = Connection::open(&path).unwrap();
|
||||
let connection = Connection::open(":memory:").unwrap();
|
||||
match connection.execute(":)") {
|
||||
Err(error) => assert_eq!(error.message,
|
||||
Some(String::from(r#"unrecognized token: ":""#))),
|
||||
@ -169,8 +167,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn set_busy_handler() {
|
||||
let (path, _directory) = setup();
|
||||
let mut connection = Connection::open(&path).unwrap();
|
||||
let mut connection = Connection::open(":memory:").unwrap();
|
||||
connection.set_busy_handler(|_| true).unwrap();
|
||||
}
|
||||
}
|
||||
|
14
src/lib.rs
14
src/lib.rs
@ -48,9 +48,6 @@
|
||||
extern crate libc;
|
||||
extern crate sqlite3_sys as ffi;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate temporary;
|
||||
|
||||
macro_rules! raise(
|
||||
($message:expr) => (return Err(::Error::from($message)));
|
||||
);
|
||||
@ -117,14 +114,3 @@ pub type Result<T> = std::result::Result<T, Error>;
|
||||
pub fn open<'l, T: AsRef<std::path::Path>>(path: T) -> Result<Connection<'l>> {
|
||||
Connection::open(path)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::path::PathBuf;
|
||||
use temporary::Directory;
|
||||
|
||||
pub fn setup() -> (PathBuf, Directory) {
|
||||
let directory = Directory::new("sqlite").unwrap();
|
||||
(directory.path().join("database.sqlite3"), directory)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user