diff options
Diffstat (limited to 'tests/fixtures/mod.rs')
-rw-r--r-- | tests/fixtures/mod.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/fixtures/mod.rs b/tests/fixtures/mod.rs index 9cfd2cf..d55f022 100644 --- a/tests/fixtures/mod.rs +++ b/tests/fixtures/mod.rs @@ -4,13 +4,18 @@ use port_check::free_local_port; use rstest::fixture; /// Error type used by tests -pub type Error = Box<std::error::Error>; +pub type Error = Box<dyn std::error::Error>; /// File names for testing purpose #[allow(dead_code)] pub static FILES: &[&str] = &["test.txt", "test.html", "test.mkv"]; -/// Test fixture which creates a temporary directory with a few files inside. +/// Directory names for testing purpose +#[allow(dead_code)] +pub static DIRECTORIES: &[&str] = &["dira/", "dirb/", "dirc/"]; + +/// Test fixture which creates a temporary directory with a few files and directories inside. +/// The directories also contain files. #[fixture] #[allow(dead_code)] pub fn tmpdir() -> TempDir { @@ -21,6 +26,14 @@ pub fn tmpdir() -> TempDir { .write_str("Test Hello Yes") .expect("Couldn't write to file"); } + for &directory in DIRECTORIES { + for &file in FILES { + tmpdir + .child(format!("{}{}", directory, file)) + .write_str(&format!("This is {}{}", directory, file)) + .expect("Couldn't write to file"); + } + } tmpdir } |