split into 3 files by... declaring them all in main

This commit is contained in:
Bel LaPointe
2026-02-11 17:21:04 -08:00
parent 13cb4d1d9a
commit 1c89507497
3 changed files with 7 additions and 9 deletions

View File

@@ -1,3 +1,5 @@
use crate::tests as tests_pkg;
use clap::Parser; use clap::Parser;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_yaml; use serde_yaml;
@@ -70,7 +72,7 @@ mod test_flags {
#[test] #[test]
fn test_flags_files_unhidden_only() { 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("plain")).unwrap();
std::fs::File::create(d.path().join(".hidden")).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());
}
}

View File

@@ -1,5 +1,6 @@
use crate::flags as flags_pkg; use crate::flags as flags_pkg;
mod flags; mod flags;
mod tests;
pub fn main() { pub fn main() {
let flags = flags_pkg::Flags::new().expect("failed to flags"); let flags = flags_pkg::Flags::new().expect("failed to flags");

3
pttodoest/src/tests.rs Normal file
View File

@@ -0,0 +1,3 @@
pub fn with_dir(mut foo: impl FnMut(tempdir::TempDir)) {
foo(tempdir::TempDir::new("").unwrap());
}