diff options
author | Sven-Hendrik Haase <svenstaro@gmail.com> | 2019-07-07 16:22:57 +0000 |
---|---|---|
committer | Sven-Hendrik Haase <svenstaro@gmail.com> | 2019-07-07 16:22:57 +0000 |
commit | 294d32ba32a9fd3b097b0582137cd477765e364f (patch) | |
tree | 7c8ec912eb2fd3e7af87b328fb3c20a17523cc08 /tests/fixtures/mod.rs | |
parent | Bump lock file (diff) | |
download | miniserve-294d32ba32a9fd3b097b0582137cd477765e364f.tar.gz miniserve-294d32ba32a9fd3b097b0582137cd477765e364f.zip |
Also check directories in tests
Diffstat (limited to '')
-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 } |