diff options
author | Nora <nora.widdecke@tu-bs.de> | 2019-02-04 22:50:33 +0100 |
---|---|---|
committer | Nora <nora.widdecke@tu-bs.de> | 2019-02-04 22:50:51 +0100 |
commit | d0cf0a35472b9d2905f94b95e8addbeec67d882e (patch) | |
tree | b006a0e6d68d3c8f81f8be725cbf9745d6bf1be3 /src/testutils.rs | |
parent | 1b67e6f8b610a2bafd34aca70c5f7cbb63ca4231 (diff) |
khline: when parsing from string, check if file actually exists
Diffstat (limited to 'src/testutils.rs')
-rw-r--r-- | src/testutils.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/testutils.rs b/src/testutils.rs index 42fa765..7b78a96 100644 --- a/src/testutils.rs +++ b/src/testutils.rs @@ -1,6 +1,7 @@ use assert_fs::prelude::*; use assert_fs::TempDir; -use std::path::PathBuf; +use assert_fs::fixture::{ChildPath, FixtureError}; +use std::path::{PathBuf,Path}; use std::fs; use defaults; @@ -21,3 +22,9 @@ pub fn prepare_testdir(template: &str) -> TempDir { testdir.child(".khaleesi/").copy_from(path_to(template), &["*"]).unwrap(); testdir } + +pub fn touch_testfile(testdir: &TempDir, relative_path: &Path) -> Result<ChildPath, FixtureError> { + let testfile = testdir.child(relative_path); + testfile.touch()?; + Ok(testfile) +} |