diff options
| author | Dirk Van Haerenborgh <vhdirk@gmail.com> | 2019-11-13 14:56:32 +0100 |
|---|---|---|
| committer | Dirk Van Haerenborgh <vhdirk@gmail.com> | 2019-11-13 14:56:32 +0100 |
| commit | 3f795961db8228da27bb4823fac2f68e57e7276a (patch) | |
| tree | dbf4916ebbd04ea281f4f86d03148c18a4d02339 /tests/main.rs | |
| parent | 422377021f9a15b30d297b6ead7864098d5b2c2d (diff) | |
| download | mail-3f795961db8228da27bb4823fac2f68e57e7276a.tar.gz | |
port tests from notmuch-python-cffi
Diffstat (limited to 'tests/main.rs')
| -rw-r--r-- | tests/main.rs | 91 |
1 files changed, 55 insertions, 36 deletions
diff --git a/tests/main.rs b/tests/main.rs index 9ad0a36..17db2bc 100644 --- a/tests/main.rs +++ b/tests/main.rs @@ -1,43 +1,62 @@ extern crate dirs; +extern crate tempfile; extern crate notmuch; +extern crate gethostname; +extern crate maildir; +extern crate lettre; +extern crate lettre_email; use std::sync::Arc; use notmuch::{Query, QueryExt}; -fn main() { - let mut mail_path = dirs::home_dir().unwrap(); - mail_path.push(".mail"); - - match notmuch::Database::open( - &mail_path.to_str().unwrap().to_string(), - notmuch::DatabaseMode::ReadOnly, - ) { - Ok(db) => { - #[cfg(feature = "v0_21")] - { - let rev = db.revision(); - println!("db revision: {:?}", rev); - } - let query = { - let dbr = Arc::new(db); - - notmuch::Query::create(dbr.clone(), &"".to_string()).unwrap() - }; - - // let mut threads = query.search_threads().unwrap(); - - // let mut threads = db.create_query(&"".to_string()).unwrap().search_threads().unwrap(); - - let mut threads = Arc::new(<Query as QueryExt>::search_threads(query).unwrap()); - - for thread in Arc::get_mut(&mut threads).unwrap() - { - println!("thread {:?} {:?}", thread.subject(), thread.authors()); - } - } - Err(err) => { - println!("Got error while trying to open db: {:?}", err); - } - } -} +mod fixtures; +use fixtures::{MailBox, NotmuchCommand}; + + + + +// fn main() { +// let mut mail_path = dirs::home_dir().unwrap(); +// mail_path.push(".mail"); + +// let md = MailBox::new(); +// let nmcmd = NotMuchCommand::new(md.path()); + +// match notmuch::Database::open( +// &mail_path.to_str().unwrap().to_string(), +// notmuch::DatabaseMode::ReadOnly, +// ) { +// Ok(db) => { +// #[cfg(feature = "v0_21")] +// { +// let rev = db.revision(); +// println!("db revision: {:?}", rev); +// } +// let query = { +// let dbr = Arc::new(db); + +// notmuch::Query::create(dbr.clone(), &"".to_string()).unwrap() +// }; + +// // let mut threads = query.search_threads().unwrap(); + +// // let mut threads = db.create_query(&"".to_string()).unwrap().search_threads().unwrap(); + +// let mut threads = Arc::new(<Query as QueryExt>::search_threads(query).unwrap()); + +// for thread in Arc::get_mut(&mut threads).unwrap() +// { +// println!("thread {:?} {:?}", thread.subject(), thread.authors()); +// } +// } +// Err(err) => { +// println!("Got error while trying to open db: {:?}", err); +// } +// } +// } + + + + + |
