closer
parent
c06091d576
commit
b37e61a223
|
|
@ -497,6 +497,47 @@ mod test_file {
|
|||
assert_eq!(0, f.stage().unwrap().len(), "{:?}", f.stage());
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_schedule_date_past() {
|
||||
tests::with_dir(|d| {
|
||||
tests::write_file(&d, "plain", "[]");
|
||||
let f = File::new(&d.path().join("plain").to_str().unwrap().to_string());
|
||||
|
||||
let mut m = serde_yaml::Mapping::new();
|
||||
m.insert("schedule".into(), "2006-01-02".into());
|
||||
let task = Task(serde_yaml::Value::Mapping(m));
|
||||
|
||||
f.append(Delta::add(task)).unwrap();
|
||||
assert_eq!(
|
||||
1,
|
||||
f.events().unwrap().0.len(),
|
||||
"{:?}",
|
||||
f.events().unwrap().0
|
||||
);
|
||||
assert_eq!(0, f.stage().unwrap().len(), "{:?}", f.stage());
|
||||
|
||||
eprintln!("0 | {:?}", f.stage().unwrap());
|
||||
f.persist_stage().unwrap();
|
||||
eprintln!("1 | {:?}", f.stage().unwrap());
|
||||
assert_eq!(
|
||||
1,
|
||||
f.events().unwrap().0.len(),
|
||||
"{:?}",
|
||||
f.events().unwrap().0
|
||||
);
|
||||
assert_eq!(0, f.stage().unwrap().len(), "{:?}", f.stage());
|
||||
|
||||
f.stage_persisted().unwrap();
|
||||
assert_eq!(
|
||||
1,
|
||||
f.events().unwrap().0.len(),
|
||||
"{:?}",
|
||||
f.events().unwrap().0
|
||||
);
|
||||
assert_eq!(1, f.stage().unwrap().len(), "{:?}", f.stage());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
|
|
|||
Loading…
Reference in New Issue