aboutsummaryrefslogtreecommitdiff
path: root/crates/test_utils
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-12-21 15:13:21 +0000
committerAleksey Kladov <[email protected]>2018-12-21 15:13:21 +0000
commit45232dfa689bafadf98b92ef30fd32ea9a5e9e7a (patch)
tree4652bd1f393540f2f5abdaaab367cfb0b46a10d6 /crates/test_utils
parentd4ef07b2355df891d4f9b7641f0246ebe5bd6a6b (diff)
organize completion tests better
Diffstat (limited to 'crates/test_utils')
-rw-r--r--crates/test_utils/src/lib.rs22
1 files changed, 10 insertions, 12 deletions
diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/src/lib.rs
index 1ae800d7c..beb936c61 100644
--- a/crates/test_utils/src/lib.rs
+++ b/crates/test_utils/src/lib.rs
@@ -10,22 +10,20 @@ pub const CURSOR_MARKER: &str = "<|>";
10 10
11#[macro_export] 11#[macro_export]
12macro_rules! assert_eq_text { 12macro_rules! assert_eq_text {
13 ($expected:expr, $actual:expr) => {{ 13 ($expected:expr, $actual:expr) => {
14 let expected = $expected; 14 assert_eq_text!($expected, $actual,)
15 let actual = $actual; 15 };
16 if expected != actual {
17 let changeset = $crate::__Changeset::new(actual, expected, "\n");
18 println!("Expected:\n{}\n\nActual:\n{}\nDiff:{}\n", expected, actual, changeset);
19 panic!("text differs");
20 }
21 }};
22 ($expected:expr, $actual:expr, $($tt:tt)*) => {{ 16 ($expected:expr, $actual:expr, $($tt:tt)*) => {{
23 let expected = $expected; 17 let expected = $expected;
24 let actual = $actual; 18 let actual = $actual;
25 if expected != actual { 19 if expected != actual {
26 let changeset = $crate::__Changeset::new(actual, expected, "\n"); 20 if expected.trim() == actual.trim() {
27 println!("Expected:\n{}\n\nActual:\n{}\n\nDiff:\n{}\n", expected, actual, changeset); 21 eprintln!("Expected:\n{:?}\n\nActual:\n{:?}\n\nWhitespace difference\n", expected, actual);
28 println!($($tt)*); 22 } else {
23 let changeset = $crate::__Changeset::new(actual, expected, "\n");
24 eprintln!("Expected:\n{}\n\nActual:\n{}\n\nDiff:\n{}\n", expected, actual, changeset);
25 }
26 eprintln!($($tt)*);
29 panic!("text differs"); 27 panic!("text differs");
30 } 28 }
31 }}; 29 }};