1extern crate chrono;
2
3mod file;
4mod learned;
5
6pub use learned::Learned;
7pub use file::write_til_file as run;
8
9#[cfg(test)]
10mod tests {
11 use super::*;
12
13 #[test]
14 fn should_collapse_input_to_string() {
15 let input = vec!["/some/path", "how", "to", "write", "tests", "in", "rust"].into_iter()
16 .map(|i| String::from(i))
17 .collect();
18 let result = Learned::new(input).expect("Could not make config from input");
19 assert_eq!("how to write tests in rust", result.description);
20 }
21
22 #[test]
23 #[should_panic]
24 fn should_panic_given_not_enough_inputs() {
25 let input = vec!["/some/path".to_string()];
26 Learned::new(input).expect("Could not make config from input");
27 }
28
29 #[test]
30 fn should_format_date() {
31 let dt = Local.ymd(2014, 11, 28);
32 assert_eq!(format_date(dt), "2014-11-28");
33 }
34}