Function ktest::runner::run_ktests
source · pub fn run_ktests<PrintFn, PathsIter>(
print: &PrintFn,
catch_unwind: &fn(f: fn()) -> Result<(), Box<dyn Any + Send>>,
test_whitelist: Option<PathsIter>,
crate_whitelist: Option<&[&str]>
) -> KtestResultwhere
PrintFn: Fn(Arguments<'_>),
PathsIter: Iterator<Item = String>,
Expand description
Run all the tests registered by #[ktest]
in the .ktest_array
section.
Need to provide a print function print
to print the test result, and a catch_unwind
implementation to catch the panic.
The whitelist
argument is optional. If it is None
, all tests compiled will be run.
If it is Some
, only the tests whose test path being the suffix of any paths in the whitelist
will be run.
Returns the test result interpreted as ok
or FAILED
.
If a test inside a crate fails, the test runner will continue to run the rest of the tests inside the crate. But the tests in the following crates will not be run.