1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*!
A custom unit testing framework inspired by Catch2.
!*/

mod runner;
mod test_case;

#[doc(hidden)]
pub mod _internal {
    pub use crate::{
        runner::{run_tests, TestSuite},
        test_case::{Section, TestDesc},
    };
    pub use maplit::{hashmap, hashset};

    use crate::test_case::{SectionId, TestContext};

    #[inline]
    pub fn is_target(id: SectionId) -> bool {
        TestContext::with(|ctx| ctx.is_target_section(id))
    }
}

/// Generate a test case.
pub use rye_macros::test_case;

#[macro_export]
macro_rules! test_main {
    ($($test_case:path),*$(,)?) => {
        fn main() {
            $crate::_internal::run_tests(&[$(&$test_case),*]);
        }
    };
}