macro_rules! dtt_assert {
($cond:expr $(, $msg:expr)?) => { ... };
}
Expand description
Asserts that the given expression is true.
If the expression is false, the macro panics with the message “Assertion failed!”.
§Arguments
$cond:expr
: The condition to be asserted.$msg:expr
(optional): The message to display if the assertion fails.
§Example
use dtt::dtt_parse;
use dtt::dtt_assert;
let is_valid = dtt_parse!("2020-02-29").is_ok();
dtt_assert!(is_valid, "The date must be valid.");