Skip to content

Commit

Permalink
Merge pull request #9 from hortont424/fix-assert-eq-hex-extra
Browse files Browse the repository at this point in the history
assert_eq_hex with extra string doesn't compile
  • Loading branch information
wcampbell0x2a committed Sep 17, 2023
2 parents fba9dbd + 796bbfd commit 7352944
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ macro_rules! assert_eq_hex {
// noticeable slow down.
panic!(r#"assertion `left == right` failed: {}
left: {:#x?}
right: {:#x?}"#, format_args!($($arg)+) &*left_val, &*right_val)
right: {:#x?}"#, format_args!($($arg)+), &*left_val, &*right_val)
}
}
}
Expand Down Expand Up @@ -127,6 +127,14 @@ mod tests {
assert_eq_hex!(vec![0x00, 0x01, 0x02], vec![0x46, 0x50, 0x40]);
}

#[test]
#[should_panic(expected = r#"assertion `left == right` failed: yikes
left: 0xff
right: 0x0"#)]
fn test_eq_more() {
assert_eq_hex!(0xff, 0x00, "yikes");
}

#[test]
#[should_panic(expected = r#"assertion `left != right` failed
left: 0x50
Expand Down

0 comments on commit 7352944

Please sign in to comment.