#unit-testing #testing-macro #lazy-evaluation #macro

lazytest

Reduces the boilerplate required for simple unit tests

3 releases

0.1.2 May 26, 2024
0.1.1 May 25, 2024
0.1.0 May 24, 2024

#1354 in Testing

Download history

97 downloads per month

MIT-0 license

4KB

Provides the [lazytest] macro to reduce the amount of code needed to write unit tests.


lazytest

Provides a macro which reduces the boilerplate required for simple unit tests.

Usage

Given the function:

pub fn answer() -> usize {
    42
}

These are equivalent:

use lazytest::lazytest;

lazytest! {
    check_answer {
        assert_eq!(answer(), 42);
    }
}
#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn check_answer() {
        assert_eq!(answer(), 42);
    }
}

No runtime deps