Add test setup with first test

This commit is contained in:
Matthias Beyer 2017-09-01 20:24:21 +02:00
parent 3bad9e2e92
commit eb32027546
3 changed files with 42 additions and 0 deletions

View file

@ -18,3 +18,6 @@ serde = "1"
libimagstore = { version = "0.4.0", path = "../../../lib/core/libimagstore" } libimagstore = { version = "0.4.0", path = "../../../lib/core/libimagstore" }
libimagerror = { version = "0.4.0", path = "../../../lib/core/libimagerror" } libimagerror = { version = "0.4.0", path = "../../../lib/core/libimagerror" }
[dev-dependencies]
env_logger = "0.3"

View file

@ -53,3 +53,39 @@ impl GPSEntry for Entry {
} }
#[cfg(test)]
mod tests {
use std::path::PathBuf;
use libimagstore::store::Store;
use entry::*;
fn setup_logging() {
use env_logger;
let _ = env_logger::init().unwrap_or(());
}
fn get_store() -> Store {
Store::new(PathBuf::from("/"), None).unwrap()
}
#[test]
fn test_set_gps() {
setup_logging();
let store = get_store();
let mut entry = store.create(PathBuf::from("test_set_gps")).unwrap();
let coordinates = Coordinates {
latitude: GPSValue::new(0, 0, 0),
longitude: GPSValue::new(0, 0, 0),
};
let res = entry.set_coordinates(coordinates);
assert!(res.is_ok());
}
}

View file

@ -24,6 +24,9 @@ extern crate toml_query;
extern crate libimagstore; extern crate libimagstore;
#[macro_use] extern crate libimagerror; #[macro_use] extern crate libimagerror;
#[cfg(test)]
extern crate env_logger;
pub mod entry; pub mod entry;
pub mod error; pub mod error;
pub mod result; pub mod result;