Crate test_panic
source ·Expand description
Utility for test cases with panic.
The author of this crate is not good at English. Forgive me if the document is hard to read.
For the same purpose, the shoud_panic
attribute is provided in the Rust
standard, but it is not so useful, hence we created this crate.
Examples
#[test]
fn test() {
let result = test_panic(|| panic!("message."));
assert!(result.is_panic());
assert!(result.message().contains("message"));
}
Enums
- Result of
test_panic
function.
Functions
- Execute the closure and get its return value or panic information.