From 294d32ba32a9fd3b097b0582137cd477765e364f Mon Sep 17 00:00:00 2001 From: Sven-Hendrik Haase Date: Sun, 7 Jul 2019 18:22:57 +0200 Subject: Also check directories in tests --- tests/fixtures/mod.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'tests/fixtures/mod.rs') 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; +pub type Error = Box; /// 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 } -- cgit v1.2.3