diff options
Diffstat (limited to 'crates/ra_syntax/tests')
-rw-r--r-- | crates/ra_syntax/tests/test.rs | 59 |
1 files changed, 23 insertions, 36 deletions
diff --git a/crates/ra_syntax/tests/test.rs b/crates/ra_syntax/tests/test.rs index 3243b27ae..168d0623d 100644 --- a/crates/ra_syntax/tests/test.rs +++ b/crates/ra_syntax/tests/test.rs | |||
@@ -23,36 +23,28 @@ fn lexer_tests() { | |||
23 | 23 | ||
24 | #[test] | 24 | #[test] |
25 | fn parser_tests() { | 25 | fn parser_tests() { |
26 | dir_tests( | 26 | dir_tests(&test_data_dir(), &["parser/inline/ok", "parser/ok"], |text, path| { |
27 | &test_data_dir(), | 27 | let file = SourceFile::parse(text); |
28 | &["parser/inline/ok", "parser/ok"], | 28 | let errors = file.errors(); |
29 | |text, path| { | 29 | assert_eq!( |
30 | let file = SourceFile::parse(text); | 30 | &*errors, |
31 | let errors = file.errors(); | 31 | &[] as &[ra_syntax::SyntaxError], |
32 | assert_eq!( | 32 | "There should be no errors in the file {:?}", |
33 | &*errors, | 33 | path.display() |
34 | &[] as &[ra_syntax::SyntaxError], | 34 | ); |
35 | "There should be no errors in the file {:?}", | 35 | dump_tree(file.syntax()) |
36 | path.display() | 36 | }); |
37 | ); | 37 | dir_tests(&test_data_dir(), &["parser/err", "parser/inline/err"], |text, path| { |
38 | dump_tree(file.syntax()) | 38 | let file = SourceFile::parse(text); |
39 | }, | 39 | let errors = file.errors(); |
40 | ); | 40 | assert_ne!( |
41 | dir_tests( | 41 | &*errors, |
42 | &test_data_dir(), | 42 | &[] as &[ra_syntax::SyntaxError], |
43 | &["parser/err", "parser/inline/err"], | 43 | "There should be errors in the file {:?}", |
44 | |text, path| { | 44 | path.display() |
45 | let file = SourceFile::parse(text); | 45 | ); |
46 | let errors = file.errors(); | 46 | dump_tree(file.syntax()) |
47 | assert_ne!( | 47 | }); |
48 | &*errors, | ||
49 | &[] as &[ra_syntax::SyntaxError], | ||
50 | "There should be errors in the file {:?}", | ||
51 | path.display() | ||
52 | ); | ||
53 | dump_tree(file.syntax()) | ||
54 | }, | ||
55 | ); | ||
56 | } | 48 | } |
57 | 49 | ||
58 | #[test] | 50 | #[test] |
@@ -87,12 +79,7 @@ fn self_hosting_parsing() { | |||
87 | let text = read_text(entry.path()); | 79 | let text = read_text(entry.path()); |
88 | let node = SourceFile::parse(&text); | 80 | let node = SourceFile::parse(&text); |
89 | let errors = node.errors(); | 81 | let errors = node.errors(); |
90 | assert_eq!( | 82 | assert_eq!(&*errors, &[], "There should be no errors in the file {:?}", entry); |
91 | &*errors, | ||
92 | &[], | ||
93 | "There should be no errors in the file {:?}", | ||
94 | entry | ||
95 | ); | ||
96 | } | 83 | } |
97 | assert!( | 84 | assert!( |
98 | count > 30, | 85 | count > 30, |