1pub mod collection;
4mod runner;
5
6use collection::CollectedTest;
7pub use runner::*;
8
9use std::path::Path;
10use std::path::PathBuf;
11
12use collection::collect_tests_or_exit;
13use collection::CollectOptions;
14use thiserror::Error;
15
16#[derive(Debug, Error)]
17#[error("{:#} ({})", err, path.display())]
18pub struct PathedIoError {
19 path: PathBuf,
20 err: std::io::Error,
21}
22
23impl PathedIoError {
24 pub fn new(path: &Path, err: std::io::Error) -> Self {
25 Self {
26 path: path.to_path_buf(),
27 err,
28 }
29 }
30}
31
32pub fn collect_and_run_tests<TData: Clone + Send + 'static>(
34 collect_options: CollectOptions<TData>,
35 run_options: RunOptions,
36 run_test: impl (Fn(&CollectedTest<TData>) -> TestResult) + Send + Sync + 'static,
37) {
38 let category = collect_tests_or_exit(collect_options);
39 run_tests(&category, run_options, run_test)
40}