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