From 1c89507497426c37a3734e65be373848759251fa Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Wed, 11 Feb 2026 17:21:04 -0800 Subject: [PATCH] split into 3 files by... declaring them all in main --- pttodoest/src/flags.rs | 12 +++--------- pttodoest/src/main.rs | 1 + pttodoest/src/tests.rs | 3 +++ 3 files changed, 7 insertions(+), 9 deletions(-) create mode 100644 pttodoest/src/tests.rs diff --git a/pttodoest/src/flags.rs b/pttodoest/src/flags.rs index d426edc..57a666f 100644 --- a/pttodoest/src/flags.rs +++ b/pttodoest/src/flags.rs @@ -1,3 +1,5 @@ +use crate::tests as tests_pkg; + use clap::Parser; use serde::{Deserialize, Serialize}; use serde_yaml; @@ -70,7 +72,7 @@ mod test_flags { #[test] fn test_flags_files_unhidden_only() { - tests::with_dir(|d| { + tests_pkg::with_dir(|d| { std::fs::File::create(d.path().join("plain")).unwrap(); std::fs::File::create(d.path().join(".hidden")).unwrap(); @@ -86,11 +88,3 @@ mod test_flags { }); } } - -mod tests { - use super::*; - - pub fn with_dir(mut foo: impl FnMut(tempdir::TempDir)) { - foo(tempdir::TempDir::new("").unwrap()); - } -} diff --git a/pttodoest/src/main.rs b/pttodoest/src/main.rs index 54626e7..6547bf1 100755 --- a/pttodoest/src/main.rs +++ b/pttodoest/src/main.rs @@ -1,5 +1,6 @@ use crate::flags as flags_pkg; mod flags; +mod tests; pub fn main() { let flags = flags_pkg::Flags::new().expect("failed to flags"); diff --git a/pttodoest/src/tests.rs b/pttodoest/src/tests.rs new file mode 100644 index 0000000..ff5abf0 --- /dev/null +++ b/pttodoest/src/tests.rs @@ -0,0 +1,3 @@ +pub fn with_dir(mut foo: impl FnMut(tempdir::TempDir)) { + foo(tempdir::TempDir::new("").unwrap()); +}