mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-07-31 04:02:00 -07:00
26 lines
739 B
Rust
26 lines
739 B
Rust
/// Like assert_eq, but nicer output for long strings.
|
|
#[cfg(test)]
|
|
#[macro_export]
|
|
macro_rules! assert_eq_printed {
|
|
($expected:expr, $got:expr, $($tt:tt)*) => {
|
|
let expected = &*$expected;
|
|
let got = &*$got;
|
|
let label = format!($($tt)*);
|
|
if expected != got {
|
|
panic!("
|
|
printed outputs differ! (label: {})
|
|
|
|
expected:
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
{}
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
got:
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
{}
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
", label, expected, got);
|
|
}
|
|
}
|
|
}
|