From b37e61a22359d472fa877a50ebe112abdd56e1e9 Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Wed, 12 Nov 2025 15:17:21 -0700 Subject: [PATCH] closer --- pttodoest/src/main.rs | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/pttodoest/src/main.rs b/pttodoest/src/main.rs index a497a27..143297f 100755 --- a/pttodoest/src/main.rs +++ b/pttodoest/src/main.rs @@ -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)]