Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- macro_rules! assert_match {
- ($e:expr, $p:pat) => {
- match $e {
- $p => (),
- e => panic!("{:?} does not match {}", e, stringify!($p)),
- }
- };
- }
- #[derive(Debug)]
- struct Value { num: i32 }
- fn main() {
- let actual_value = Value { num: 2 };
- let expected_num = 1;
- assert_match!(actual_value, Value { num: expected_num });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement