From c622000413351915d08e270e8962f5fbaedf0437 Mon Sep 17 00:00:00 2001 From: pcpthm Date: Fri, 22 Mar 2019 03:15:16 +0900 Subject: Improve reparse fuzz test --- crates/ra_syntax/src/fuzz.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'crates/ra_syntax/src') diff --git a/crates/ra_syntax/src/fuzz.rs b/crates/ra_syntax/src/fuzz.rs index efb080ac2..c7084bc6d 100644 --- a/crates/ra_syntax/src/fuzz.rs +++ b/crates/ra_syntax/src/fuzz.rs @@ -46,7 +46,19 @@ impl CheckReparse { assert_eq!(&new_file.syntax().text().to_string(), &self.edited_text); let full_reparse = SourceFile::parse(&self.edited_text); for (a, b) in new_file.syntax().descendants().zip(full_reparse.syntax().descendants()) { - assert_eq!(a.kind(), b.kind(), "different syntax tree produced by a full reparse"); + if (a.kind(), a.range()) != (b.kind(), b.range()) { + eprint!("original:\n{}", file.syntax().debug_dump()); + eprint!("reparsed:\n{}", new_file.syntax().debug_dump()); + eprint!("full reparse:\n{}", full_reparse.syntax().debug_dump()); + assert_eq!( + format!("{:?}", a), + format!("{:?}", b), + "different syntax tree produced by the full reparse" + ); + } } + // FIXME + // assert_eq!(new_file.errors(), full_reparse.errors()); + assert_eq!(new_file.errors().is_empty(), full_reparse.errors().is_empty()); } } -- cgit v1.2.3