extern crate chrono;
mod file;
mod learned;
pub use learned::Learned;
pub use file::write_til_file as run;
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn should_collapse_input_to_string() {
let input = vec!["/some/path", "how", "to", "write", "tests", "in", "rust"].into_iter()
.map(|i| String::from(i))
.collect();
let result = Learned::new(input).expect("Could not make config from input");
assert_eq!("how to write tests in rust", result.description);
}
#[test]
#[should_panic]
fn should_panic_given_not_enough_inputs() {
let input = vec!["/some/path".to_string()];
Learned::new(input).expect("Could not make config from input");
}
#[test]
fn should_format_date() {
let dt = Local.ymd(2014, 11, 28);
assert_eq!(format_date(dt), "2014-11-28");
}
}