2017-06-09 13:49:21 +00:00
|
|
|
//
|
|
|
|
// imag - the personal information management suite for the commandline
|
|
|
|
// Copyright (C) 2015, 2016 Matthias Beyer <mail@beyermatthias.de> and contributors
|
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; version
|
|
|
|
// 2.1 of the License.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
//
|
|
|
|
|
|
|
|
pub mod create;
|
2017-07-15 13:01:45 +00:00
|
|
|
pub mod filter;
|
2017-06-09 13:49:21 +00:00
|
|
|
pub mod get;
|
|
|
|
pub mod setendtime;
|
|
|
|
pub mod storeid;
|
|
|
|
pub mod tag;
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
mod test {
|
2017-07-15 18:14:33 +00:00
|
|
|
use chrono::naive::NaiveDate;
|
2017-06-09 13:49:21 +00:00
|
|
|
|
|
|
|
use libimagstore::store::Store;
|
|
|
|
|
|
|
|
use super::setendtime::*;
|
|
|
|
use super::tag::*;
|
|
|
|
|
|
|
|
fn get_store() -> Store {
|
|
|
|
use std::path::PathBuf;
|
|
|
|
use libimagstore::file_abstraction::InMemoryFileAbstraction;
|
|
|
|
|
|
|
|
let backend = Box::new(InMemoryFileAbstraction::new());
|
2017-12-22 10:24:04 +00:00
|
|
|
Store::new_with_backend(PathBuf::from("/"), &None, backend).unwrap()
|
2017-06-09 13:49:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_building_chain() {
|
|
|
|
let now = NaiveDate::from_ymd(2000, 1, 1).and_hms(0, 0, 1);
|
|
|
|
let then = NaiveDate::from_ymd(2000, 1, 1).and_hms(0, 0, 2);
|
|
|
|
let store = get_store();
|
|
|
|
let tags = vec!["foo", "bar"];
|
|
|
|
|
|
|
|
let iter = tags.into_iter().map(String::from);
|
|
|
|
|
2017-08-26 17:41:55 +00:00
|
|
|
let _ : SetEndTimeIter = TagIter::new(Box::new(iter))
|
2017-06-09 13:49:21 +00:00
|
|
|
.create_storeids(now)
|
|
|
|
.create_entries(&store)
|
|
|
|
.set_end_time(then);
|
|
|
|
// just to see whether this compiles, actually.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|