Macro ntest::assert_panics

source ·
macro_rules! assert_panics {
    ($x:block) => { ... };
    ($x:block,) => { ... };
}
Expand description

A panic in Rust is not always implemented via unwinding, but can be implemented by aborting the process as well. This function only catches unwinding panics, not those that abort the process. See the catch unwind documentation for more information.

§Examples

This call won’t panic.

// Other panics can happen before this call.
assert_panics!({panic!("I am panicing")});

This call will panic.

assert_panics!({println!("I am not panicing")});