Attribute Macro kunit_tests

Source
#[kunit_tests]
Expand description

Registers a KUnit test suite and its test cases using a user-space like syntax.

This macro should be used on modules. If CONFIG_KUNIT (in .config) is n, the target module is ignored.

§Examples

#[kunit_tests(kunit_test_suit_name)]
mod tests {
    #[test]
    fn foo() {
        assert_eq!(1, 1);
    }

    #[test]
    fn bar() {
        assert_eq!(2, 2);
    }
}