diff options
Diffstat (limited to 'crates/assert_eq_text')
-rw-r--r-- | crates/assert_eq_text/Cargo.toml | 8 | ||||
-rw-r--r-- | crates/assert_eq_text/src/lib.rs | 36 |
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] | ||
2 | name = "assert_eq_text" | ||
3 | version = "0.1.0" | ||
4 | authors = ["Aleksey Kladov <[email protected]>"] | ||
5 | |||
6 | [dependencies] | ||
7 | difference = "2.0.0" | ||
8 | itertools = "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 @@ | |||
1 | extern crate difference; | ||
2 | extern crate itertools; | ||
3 | |||
4 | use std::fmt; | ||
5 | use itertools::Itertools; | ||
6 | |||
7 | pub use self::difference::Changeset as __Changeset; | ||
8 | |||
9 | #[macro_export] | ||
10 | macro_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 | |||
32 | pub 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 | } | ||