1
0
Fork 0
forked from wry/wry
wry/src/it/test_macros.rs
2024-04-03 17:08:27 +02:00

32 lines
797 B
Rust

macro_rules! tassert {
($cond:expr) => {
if !$cond {
bail!(
"Assert `{}` failed ({}:{})",
stringify!($cond),
file!(),
line!()
);
}
};
}
macro_rules! tassert_eq {
($left:expr, $right:expr) => {{
match ($left, $right) {
(left, right) => {
if left != right {
bail!(
"Assert `{} = {:?} = {:?} = {}` failed ({}:{})",
stringify!($left),
left,
right,
stringify!($right),
file!(),
line!()
);
}
}
}
}};
}