From 45232dfa689bafadf98b92ef30fd32ea9a5e9e7a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 21 Dec 2018 18:13:21 +0300 Subject: organize completion tests better --- crates/test_utils/src/lib.rs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'crates/test_utils') 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 = "<|>"; #[macro_export] macro_rules! assert_eq_text { - ($expected:expr, $actual:expr) => {{ - let expected = $expected; - let actual = $actual; - if expected != actual { - let changeset = $crate::__Changeset::new(actual, expected, "\n"); - println!("Expected:\n{}\n\nActual:\n{}\nDiff:{}\n", expected, actual, changeset); - panic!("text differs"); - } - }}; + ($expected:expr, $actual:expr) => { + assert_eq_text!($expected, $actual,) + }; ($expected:expr, $actual:expr, $($tt:tt)*) => {{ let expected = $expected; let actual = $actual; if expected != actual { - let changeset = $crate::__Changeset::new(actual, expected, "\n"); - println!("Expected:\n{}\n\nActual:\n{}\n\nDiff:\n{}\n", expected, actual, changeset); - println!($($tt)*); + if expected.trim() == actual.trim() { + eprintln!("Expected:\n{:?}\n\nActual:\n{:?}\n\nWhitespace difference\n", expected, actual); + } else { + let changeset = $crate::__Changeset::new(actual, expected, "\n"); + eprintln!("Expected:\n{}\n\nActual:\n{}\n\nDiff:\n{}\n", expected, actual, changeset); + } + eprintln!($($tt)*); panic!("text differs"); } }}; -- cgit v1.2.3