[][src]Macro assert2::check

check!() { /* proc-macro */ }

Check if an expression evaluates to true or matches a pattern.

Use a let expression to test an expression against a pattern: check!(let pattern = expr). For other tests, just give a boolean expression to the macro: check!(1 + 2 == 2).

If the expression evaluates to false or if the pattern doesn't match, an assertion failure is printed but the macro does not panic immediately. The check macro will cause the running test to fail eventually.

Use assert! if you want the test to panic instantly.

Currently, this macro uses a scope guard to delay the panic. However, this may change in the future if there is a way to signal a test failure without panicking. Do not rely on check!() to panic.