Clean up the unit tests

This commit is contained in:
Ivan Ukhov 2015-08-01 14:07:34 -04:00
parent 02f8c79c9f
commit b433054c82
2 changed files with 2 additions and 19 deletions

View File

@ -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();
}
}

View File

@ -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)
}
}