aboutsummaryrefslogtreecommitdiff
path: root/crates/assert_eq_text/src/lib.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-25 12:26:34 +0100
committerAleksey Kladov <[email protected]>2018-08-25 12:26:34 +0100
commit2d41bc3e6c1adb8abce5c796cfd24f77fee6f420 (patch)
treee3b683b98ca0720d42ae55565741bd0ef806f631 /crates/assert_eq_text/src/lib.rs
parente4828124238c4238a7f5532621d1f2df2170e77a (diff)
rename
Diffstat (limited to 'crates/assert_eq_text/src/lib.rs')
-rw-r--r--crates/assert_eq_text/src/lib.rs36
1 files changed, 0 insertions, 36 deletions
diff --git a/crates/assert_eq_text/src/lib.rs b/crates/assert_eq_text/src/lib.rs
deleted file mode 100644
index 26b9bfb38..000000000
--- a/crates/assert_eq_text/src/lib.rs
+++ /dev/null
@@ -1,36 +0,0 @@
1extern crate difference;
2extern crate itertools;
3
4use std::fmt;
5use itertools::Itertools;
6
7pub use self::difference::Changeset as __Changeset;
8
9#[macro_export]
10macro_rules! assert_eq_text {
11 ($expected:expr, $actual:expr) => {{
12 let expected = $expected;
13 let actual = $actual;
14 if expected != actual {
15 let changeset = $crate::__Changeset::new(actual, expected, "\n");
16 println!("Expected:\n{}\n\nActual:\n{}\nDiff:{}\n", expected, actual, changeset);
17 panic!("text differs");
18 }
19 }};
20 ($expected:expr, $actual:expr, $($tt:tt)*) => {{
21 let expected = $expected;
22 let actual = $actual;
23 if expected != actual {
24 let changeset = $crate::__Changeset::new(actual, expected, "\n");
25 println!("Expected:\n{}\n\nActual:\n{}\n\nDiff:\n{}\n", expected, actual, changeset);
26 println!($($tt)*);
27 panic!("text differs");
28 }
29 }};
30}
31
32pub fn assert_eq_dbg(expected: &str, actual: &impl fmt::Debug) {
33 let actual = format!("{:?}", actual);
34 let expected = expected.lines().map(|l| l.trim()).join(" ");
35 assert_eq!(expected, actual);
36}