aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDirk Van Haerenborgh <vhdirk@gmail.com>2018-04-14 12:32:05 +0200
committerDirk Van Haerenborgh <vhdirk@gmail.com>2018-04-14 12:32:05 +0200
commitf4e2389d809e297db9684e7561278d78a5c09130 (patch)
tree3ea70911138768ea0ce5973f5871baa45d841943
parenta45f084c5064da77b0b6afde3aae1e83c15e3efd (diff)
downloadmail-f4e2389d809e297db9684e7561278d78a5c09130.tar.gz
fix unit test for travis
-rw-r--r--README.md1
-rw-r--r--tests/main.rs25
2 files changed, 17 insertions, 9 deletions
diff --git a/README.md b/README.md
index 28ea256..3f5886f 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,7 @@ notmuch-rs
This is not much more than a wrapper for the [notmuch](https://notmuchmail.org/) C api.
[![Build Status](https://travis-ci.org/vhdirk/notmuch-rs.svg?branch=master)](https://travis-ci.org/vhdirk/notmuch-rs)
+[![Crates.io](https://img.shields.io/crates/v/notmuch.svg)](https://crates.io/crates/notmuch)
## Building
**notmuch-rs** expects libnotmuch development files to be installed on your system.
diff --git a/tests/main.rs b/tests/main.rs
index a6dd022..b92bcf7 100644
--- a/tests/main.rs
+++ b/tests/main.rs
@@ -5,16 +5,23 @@ fn main() {
let mut mail_path = std::env::home_dir().unwrap();
mail_path.push(".mail");
- let db = notmuch::Database::open(&mail_path.to_str().unwrap().to_string(), notmuch::DatabaseMode::ReadOnly).unwrap();
- let query = db.create_query(&"".to_string()).unwrap();
- let mut threads = query.search_threads().unwrap();
+ match notmuch::Database::open(&mail_path.to_str().unwrap().to_string(), notmuch::DatabaseMode::ReadOnly){
+ Ok(db) => {
+ let query = db.create_query(&"".to_string()).unwrap();
+ let mut threads = query.search_threads().unwrap();
- loop {
- match threads.next() {
- Some(thread) => {
- println!("thread {:?} {:?}", thread.subject(), thread.authors());
- },
- None => { break }
+ loop {
+ match threads.next() {
+ Some(thread) => {
+ println!("thread {:?} {:?}", thread.subject(), thread.authors());
+ },
+ None => { break }
+ }
+ }
+
+ },
+ Err(err) =>{
+ println!("Got error while trying to open db: {:?}", err);
}
}
}