diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2019-10-20 13:11:44 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2019-11-02 18:19:30 +0100 |
commit | f1b5b0915b40beca9c34a38f7799fb795682fa0f (patch) | |
tree | 3926cce125da0bac19668e847b95e53d137b5c3d /tests | |
parent | a8b75ad2ba2ec04ac9ec0f317f87659e15cb4a78 (diff) |
Refactor file_path and provide helper function for store path
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ui/src/imag.rs | 9 | ||||
-rw-r--r-- | tests/ui/src/imag_create.rs | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/tests/ui/src/imag.rs b/tests/ui/src/imag.rs index 3c517ce2..34edbb4c 100644 --- a/tests/ui/src/imag.rs +++ b/tests/ui/src/imag.rs @@ -55,7 +55,16 @@ pub fn stdout_of_command(mut command: Command) -> Vec<String> { /// Create a PathBuf for a file in a TempDir pub fn file_path(tempdir: &TempDir, path_elements: &[&str]) -> PathBuf { + create_path_for(tempdir.path().to_path_buf(), path_elements) +} + +pub fn store_path(tempdir: &TempDir, path_elements: &[&str]) -> PathBuf { let mut path = tempdir.path().to_path_buf(); + path.push("store"); + create_path_for(path, path_elements) +} + +fn create_path_for(mut path: PathBuf, path_elements: &[&str]) -> PathBuf { path_elements.iter().for_each(|el| path.push(el)); debug!("Calculated path = {:?}", path); path diff --git a/tests/ui/src/imag_create.rs b/tests/ui/src/imag_create.rs index a857ed28..993ba366 100644 --- a/tests/ui/src/imag_create.rs +++ b/tests/ui/src/imag_create.rs @@ -50,7 +50,7 @@ fn test_creating_works() { call(&imag_home, &["test"]); - let entry_path = crate::imag::file_path(&imag_home, &["store", "test"]); + let entry_path = crate::imag::store_path(&imag_home, &["test"]); assert!(entry_path.exists(), "Entry was not created: {:?}", entry_path); assert!(entry_path.is_file() , "Entry is not a file: {:?}", entry_path); |