diff options
author | Aleksey Kladov <[email protected]> | 2019-07-18 17:23:05 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-07-19 11:16:24 +0100 |
commit | d402974aa0af6de290245a9d2a69a5d56c4fa610 (patch) | |
tree | df4a0e38e548f9f74592e00a2c5a7d37bab3c4c2 /crates/ra_syntax/src/fuzz.rs | |
parent | 58d4983ba5745975446d60f2886d96f8d2adf0f2 (diff) |
migrate ra_syntax to the new rowan API
Diffstat (limited to 'crates/ra_syntax/src/fuzz.rs')
-rw-r--r-- | crates/ra_syntax/src/fuzz.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_syntax/src/fuzz.rs b/crates/ra_syntax/src/fuzz.rs index 00039f970..716925b2f 100644 --- a/crates/ra_syntax/src/fuzz.rs +++ b/crates/ra_syntax/src/fuzz.rs | |||
@@ -9,7 +9,7 @@ fn check_file_invariants(file: &SourceFile) { | |||
9 | 9 | ||
10 | pub fn check_parser(text: &str) { | 10 | pub fn check_parser(text: &str) { |
11 | let file = SourceFile::parse(text); | 11 | let file = SourceFile::parse(text); |
12 | check_file_invariants(&file.tree); | 12 | check_file_invariants(&file.tree()); |
13 | } | 13 | } |
14 | 14 | ||
15 | #[derive(Debug, Clone)] | 15 | #[derive(Debug, Clone)] |
@@ -45,16 +45,16 @@ impl CheckReparse { | |||
45 | pub fn run(&self) { | 45 | pub fn run(&self) { |
46 | let parse = SourceFile::parse(&self.text); | 46 | let parse = SourceFile::parse(&self.text); |
47 | let new_parse = parse.reparse(&self.edit); | 47 | let new_parse = parse.reparse(&self.edit); |
48 | check_file_invariants(&new_parse.tree); | 48 | check_file_invariants(&new_parse.tree()); |
49 | assert_eq!(&new_parse.tree.syntax().text().to_string(), &self.edited_text); | 49 | assert_eq!(&new_parse.tree().syntax().text().to_string(), &self.edited_text); |
50 | let full_reparse = SourceFile::parse(&self.edited_text); | 50 | let full_reparse = SourceFile::parse(&self.edited_text); |
51 | for (a, b) in | 51 | for (a, b) in |
52 | new_parse.tree.syntax().descendants().zip(full_reparse.tree.syntax().descendants()) | 52 | new_parse.tree().syntax().descendants().zip(full_reparse.tree().syntax().descendants()) |
53 | { | 53 | { |
54 | if (a.kind(), a.range()) != (b.kind(), b.range()) { | 54 | if (a.kind(), a.range()) != (b.kind(), b.range()) { |
55 | eprint!("original:\n{}", parse.tree.syntax().debug_dump()); | 55 | eprint!("original:\n{}", parse.tree().syntax().debug_dump()); |
56 | eprint!("reparsed:\n{}", new_parse.tree.syntax().debug_dump()); | 56 | eprint!("reparsed:\n{}", new_parse.tree().syntax().debug_dump()); |
57 | eprint!("full reparse:\n{}", full_reparse.tree.syntax().debug_dump()); | 57 | eprint!("full reparse:\n{}", full_reparse.tree().syntax().debug_dump()); |
58 | assert_eq!( | 58 | assert_eq!( |
59 | format!("{:?}", a), | 59 | format!("{:?}", a), |
60 | format!("{:?}", b), | 60 | format!("{:?}", b), |