From 2076ebd6f4cd5a07d3e4167c01a1a1f106acffbb Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Tue, 11 Nov 2025 19:22:19 -0700 Subject: [PATCH] some test edit --- pttodoest/src/main.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/pttodoest/src/main.rs b/pttodoest/src/main.rs index c3b4af5..c41a9d6 100755 --- a/pttodoest/src/main.rs +++ b/pttodoest/src/main.rs @@ -620,4 +620,32 @@ mod edit { Ok(()) } + + #[cfg(test)] + mod test_edit { + use super::*; + + #[test] + fn test_build_empty() { + tests::with_dir(|d| { + build_dir(&d, &Files { files: vec![] }).expect("failed to build empty dir"); + }); + } + + #[test] + fn test_build_with_files() { + tests::with_dir(|d1| { + tests::write_file(&d1, "file_a", "hello world a"); + tests::write_file(&d1, "file_b", "hello world b"); + let p1 = d1.path().join("file_a").display().to_string(); + let p2 = d1.path().join("file_b").display().to_string(); + let files = Files::new(&vec![p1, p2]); + tests::with_dir(|d2| { + build_dir(&d2, &files).expect("failed to build non-empty dir"); + tests::file_contains(&d2, "file_a", "hello world a"); + tests::file_contains(&d2, "file_b", "hello world b"); + }); + }); + } + } }