Macro mfio_rt::test_suite
source · macro_rules! test_suite { ($test_ident:ident, $fs_builder:expr) => { ... }; }
Available on crate feature
test_suite
only.Expand description
Builds filesystem test suite.
This includes all default tests, if you wish to not do that, please use
test_suite_base!
macro.
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 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!(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)
});
});