aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
authorpcpthm <[email protected]>2019-03-21 18:15:16 +0000
committerpcpthm <[email protected]>2019-03-21 23:09:11 +0000
commitc622000413351915d08e270e8962f5fbaedf0437 (patch)
treeb993d1c431f7d1ea976685eb74f489c6c17e8dd8 /crates/ra_syntax
parent0acb61a911659537c51daf6793c67ef0c2b55bc9 (diff)
Improve reparse fuzz test
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/fuzz.rs14
1 files changed, 13 insertions, 1 deletions
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 {
46 assert_eq!(&new_file.syntax().text().to_string(), &self.edited_text); 46 assert_eq!(&new_file.syntax().text().to_string(), &self.edited_text);
47 let full_reparse = SourceFile::parse(&self.edited_text); 47 let full_reparse = SourceFile::parse(&self.edited_text);
48 for (a, b) in new_file.syntax().descendants().zip(full_reparse.syntax().descendants()) { 48 for (a, b) in new_file.syntax().descendants().zip(full_reparse.syntax().descendants()) {
49 assert_eq!(a.kind(), b.kind(), "different syntax tree produced by a full reparse"); 49 if (a.kind(), a.range()) != (b.kind(), b.range()) {
50 eprint!("original:\n{}", file.syntax().debug_dump());
51 eprint!("reparsed:\n{}", new_file.syntax().debug_dump());
52 eprint!("full reparse:\n{}", full_reparse.syntax().debug_dump());
53 assert_eq!(
54 format!("{:?}", a),
55 format!("{:?}", b),
56 "different syntax tree produced by the full reparse"
57 );
58 }
50 } 59 }
60 // FIXME
61 // assert_eq!(new_file.errors(), full_reparse.errors());
62 assert_eq!(new_file.errors().is_empty(), full_reparse.errors().is_empty());
51 } 63 }
52} 64}