mirror of
https://github.com/ratatui-org/ratatui
synced 2024-11-22 04:33:13 +00:00
feat: Adds message to assert_buffer_eq!
✨
This commit is contained in:
parent
2819eea82b
commit
9f1b8c9c68
1 changed files with 4 additions and 1 deletions
|
@ -4,6 +4,9 @@
|
|||
#[macro_export]
|
||||
macro_rules! assert_buffer_eq {
|
||||
($actual_expr:expr, $expected_expr:expr) => {
|
||||
assert_buffer_eq!($actual_expr, $expected_expr, "buffers not equal")
|
||||
};
|
||||
($actual_expr:expr, $expected_expr:expr, $message:expr) => {
|
||||
match (&$actual_expr, &$expected_expr) {
|
||||
(actual, expected) => {
|
||||
if actual.area != expected.area {
|
||||
|
@ -46,7 +49,7 @@ macro_rules! assert_buffer_eq {
|
|||
}
|
||||
// shouldn't get here, but this guards against future behavior
|
||||
// that changes equality but not area or content
|
||||
assert_eq!(actual, expected, "buffers not equal");
|
||||
assert_eq!(actual, expected, $message);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue