b334fa49b2
type: testing
13 lines
346 B
Rust
13 lines
346 B
Rust
macro_rules! assert_matches {
|
|
($expression:expr, $( $pattern:pat )|+ $( if $guard:expr )?) => {
|
|
match $expression {
|
|
$( $pattern )|+ $( if $guard )? => {}
|
|
left => panic!(
|
|
"assertion failed: (left ~= right)\n left: `{:?}`\n right: `{}`",
|
|
left,
|
|
stringify!($($pattern)|+ $(if $guard)?)
|
|
),
|
|
}
|
|
}
|
|
}
|