aboutsummaryrefslogtreecommitdiff
path: root/crates/assert_eq_text/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/assert_eq_text/src/lib.rs')
-rw-r--r--crates/assert_eq_text/src/lib.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/crates/assert_eq_text/src/lib.rs b/crates/assert_eq_text/src/lib.rs
new file mode 100644
index 000000000..ed942d81a
--- /dev/null
+++ b/crates/assert_eq_text/src/lib.rs
@@ -0,0 +1,25 @@
1extern crate difference;
2pub use self::difference::Changeset as __Changeset;
3
4#[macro_export]
5macro_rules! assert_eq_text {
6 ($expected:expr, $actual:expr) => {{
7 let expected = $expected;
8 let actual = $actual;
9 if expected != actual {
10 let changeset = $crate::__Changeset::new(actual, expected, "\n");
11 println!("Expected:\n{}\n\nActual:\n{}\nDiff:{}\n", expected, actual, changeset);
12 panic!("text differs");
13 }
14 }};
15 ($expected:expr, $actual:expr, $($tt:tt)*) => {{
16 let expected = $expected;
17 let actual = $actual;
18 if expected != actual {
19 let changeset = $crate::__Changeset::new(actual, expected, "\n");
20 println!("Expected:\n{}\n\nActual:\n{}\n\nDiff:\n{}\n", expected, actual, changeset);
21 println!($($tt)*);
22 panic!("text differs");
23 }
24 }};
25}