Macro mfio_rt::test_suite_base
source · macro_rules! test_suite_base { ($test_ident:ident, $fs_builder:expr, $($(#[cfg($meta:meta)])* $test:ident),*) => { ... }; }
Available on crate feature
test_suite
only.Expand description
Builds filesystem test suite.
Unlike test_suite!
, this function does not include any tests, and they
must be added manually. Please see the fs_tests
module for a list of available tests.
The first parameter of the macro is the name of the generated module, while the second one contains a closure containing the test name and an asynchronous closure to be executed.
The third argument an onwards is a comma separated list of tests to run.
The closure that runs contains the entire test_suite modules. It accepts a &'static mut T
,
where T: Fs
. To get a static ref, use the staticify
function. It is unsound, but necessary
to make test suite generation code ergonomic.
Examples
use mfio_rt::*;
test_suite_base!(tests_default, |test_name, closure| {
let _ = ::env_logger::builder().is_test(true).try_init();
let mut rt = NativeRt::default();
let rt = staticify(&mut rt);
let dir = TempDir::new(test_name).unwrap();
rt.set_cwd(dir.path().to_path_buf());
rt.run(move |rt| {
let run = TestRun::new(rt, dir);
closure(run)
});
},
dirs_equal,
files_equal
);