diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2019-12-20 12:29:51 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2019-12-20 12:29:51 +0100 |
commit | 0be8a499fa29e860e984cad61a721be9ad28026e (patch) | |
tree | 25d8e9de01f269f3e7039b8c1bdcaf4ec57545bb /src/testing/utils.rs | |
parent | 4e065267398aaedcf827a3a26f11b0cba8d9bb19 (diff) |
Move code for testing to submodule
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/testing/utils.rs')
-rw-r--r-- | src/testing/utils.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/testing/utils.rs b/src/testing/utils.rs new file mode 100644 index 0000000..ade3ea1 --- /dev/null +++ b/src/testing/utils.rs @@ -0,0 +1,16 @@ +use assert_fs::fixture::{ChildPath, FixtureError}; +use assert_fs::prelude::*; +use assert_fs::TempDir; +use std::path::{Path, PathBuf}; + +pub fn path_to(artifact: &str) -> PathBuf { + [env!("CARGO_MANIFEST_DIR"), "testdata", artifact] + .iter() + .collect() +} + +pub fn touch_testfile(testdir: &TempDir, relative_path: &Path) -> Result<ChildPath, FixtureError> { + let testfile = testdir.child(relative_path); + testfile.touch()?; + Ok(testfile) +} |