mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-31 07:37:30 +00:00
organize completion tests better
This commit is contained in:
parent
d4ef07b235
commit
45232dfa68
5 changed files with 488 additions and 393 deletions
|
@ -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");
|
||||
}
|
||||
}};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue