Skip to content
Myr

macros.rs

This file

Path

crates/printer/src/macros.rs

24 lines · 670 bytes · Rust

Last changed by

Not known.

History of this file

Take it

1/// Like assert_eq, but nicer output for long strings.2#[cfg(test)]3#[macro_export]4macro_rules! assert_eq_printed {5    ($expected:expr, $got:expr) => {6        let expected = &*$expected;7        let got = &*$got;8        if expected != got {9            panic!("10printed outputs differ!1112expected:13~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~14{}15~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~1617got:18~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~19{}20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~21", expected, got);22        }23    }24}