Move a test from /tests to /src

This commit is contained in:
Ivan Ukhov
2015-06-08 09:37:44 -04:00
parent a8396a0d1e
commit 1f0db50312
3 changed files with 38 additions and 10 deletions

View File

@ -3,6 +3,9 @@
extern crate libc;
extern crate sqlite3_sys as raw;
#[cfg(test)]
extern crate temporary;
macro_rules! raise(
($message:expr) => (return Err(::Error::from($message)));
);
@ -68,3 +71,18 @@ pub use statement::{Statement, Binding, Value};
pub fn open(path: &std::path::Path) -> Result<Database> {
Database::open(path)
}
#[cfg(test)]
mod tests {
use std::path::PathBuf;
use temporary::Directory;
macro_rules! ok(
($result:expr) => ($result.unwrap());
);
pub fn setup() -> (PathBuf, Directory) {
let directory = ok!(Directory::new("sqlite"));
(directory.path().join("database.sqlite3"), directory)
}
}