[−][src]Macro assertify::assertify
Assert an expression is true or give a useful error when it isn’t.
If the expression contains a comparison, e.g. ==
, then the failure message
will display the value of both sides of the comparison. Note that the
right side will be listed as the “expected” value — think “right” as in
“correct.”
Examples
Error for a failed comparison
assertify!(1 + 2 == 0);
Produces:
---- tests::fail_simple_eq stdout ----
thread 'tests::simple_eq' panicked at 'failed: 1 + 2 == 0
actual: 3
expected: == 0
', src/lib.rs:96:9
Error for other failures
assertify!(false);
Produces:
---- tests::fail_simple_literal stdout ----
thread 'tests::fail_simple_literal' panicked at 'failed: false', src/lib.rs:131:9