[go: up one dir, main page]

libtest-mimic 0.8.0

Write your own test harness that looks and behaves like the built-in test harness used by `rustc --test`
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use libtest_mimic::{Trial, Arguments};


#[test]
fn check_test_on_main_thread() {
    let outer_thread = std::thread::current().id();

    let mut args = Arguments::default();
    args.test_threads = Some(1);
    let conclusion = libtest_mimic::run(&args, vec![Trial::test("check", move || {
        assert_eq!(outer_thread, std::thread::current().id());
        Ok(())
    })]);

    assert_eq!(conclusion.num_passed, 1);
}