diff options
author | Omer Ben-Amram <omerbenamram@gmail.com> | 2019-06-03 16:06:28 +0300 |
---|---|---|
committer | Omer Ben-Amram <omerbenamram@gmail.com> | 2019-06-03 16:06:28 +0300 |
commit | b4725823ce8a834fb4bc2f924d181f4efd12cd48 (patch) | |
tree | 3f81a7500b2bcbddddbbaf307962cb71f5d2edbe /tests/fixtures.rs | |
parent | 809cc220afa8facd149196cd1d921541c2bca0c6 (diff) |
overhauled CLI
Diffstat (limited to 'tests/fixtures.rs')
-rw-r--r-- | tests/fixtures.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/fixtures.rs b/tests/fixtures.rs new file mode 100644 index 0000000..17dfed6 --- /dev/null +++ b/tests/fixtures.rs @@ -0,0 +1,27 @@ +#![allow(dead_code)] +use std::path::PathBuf; + +use std::sync::{Once, ONCE_INIT}; + +static LOGGER_INIT: Once = ONCE_INIT; + +// Rust runs the tests concurrently, so unless we synchronize logging access +// it will crash when attempting to run `cargo test` with some logging facilities. +pub fn ensure_env_logger_initialized() { + LOGGER_INIT.call_once(env_logger::init); +} + +pub fn samples_dir() -> PathBuf { + PathBuf::from(file!()) + .parent() + .unwrap() + .parent() + .unwrap() + .join("samples") + .canonicalize() + .unwrap() +} + +pub fn mft_sample() -> PathBuf { + samples_dir().join("MFT") +} |