aboutsummaryrefslogtreecommitdiff
path: root/crates/assert_eq_text
diff options
context:
space:
mode:
Diffstat (limited to 'crates/assert_eq_text')
-rw-r--r--crates/assert_eq_text/Cargo.toml8
-rw-r--r--crates/assert_eq_text/src/lib.rs36
2 files changed, 0 insertions, 44 deletions
diff --git a/crates/assert_eq_text/Cargo.toml b/crates/assert_eq_text/Cargo.toml
deleted file mode 100644
index e122bbbeb..000000000
--- a/crates/assert_eq_text/Cargo.toml
+++ /dev/null
@@ -1,8 +0,0 @@
1[package]
2name = "assert_eq_text"
3version = "0.1.0"
4authors = ["Aleksey Kladov <[email protected]>"]
5
6[dependencies]
7difference = "2.0.0"
8itertools = "0.7.8"
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}