[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
use common::{args, check};
use libtest_mimic::{Trial, Conclusion};

#[macro_use]
mod common;


fn tests() -> Vec<Trial> {
    vec![
        Trial::test("passes", || Ok(())),
        Trial::test("panics", || panic!("uh oh")),
    ]
}

#[test]
fn normal() {
    check(args([]), tests, 2,
        Conclusion {
            num_filtered_out: 0,
            num_passed: 1,
            num_failed: 1,
            num_ignored: 0,
            num_measured: 0,
        },
        "
            test passes ... ok
            test panics ... FAILED

            failures:

            ---- panics ----
            test panicked: uh oh


            failures:
                panics
        "
    );
}