diff options
Diffstat (limited to 'crates/ra_syntax/tests/test.rs')
-rw-r--r-- | crates/ra_syntax/tests/test.rs | 56 |
1 files changed, 31 insertions, 25 deletions
diff --git a/crates/ra_syntax/tests/test.rs b/crates/ra_syntax/tests/test.rs index 9d94a1a23..2235dc401 100644 --- a/crates/ra_syntax/tests/test.rs +++ b/crates/ra_syntax/tests/test.rs | |||
@@ -1,12 +1,10 @@ | |||
1 | extern crate ra_syntax; | 1 | extern crate ra_syntax; |
2 | #[macro_use] | ||
3 | extern crate test_utils; | 2 | extern crate test_utils; |
4 | extern crate walkdir; | 3 | extern crate walkdir; |
5 | 4 | ||
6 | use std::{ | 5 | use std::{ |
7 | fmt::Write, | 6 | fmt::Write, |
8 | fs, | 7 | path::{PathBuf, Component}, |
9 | path::{Path, PathBuf, Component}, | ||
10 | }; | 8 | }; |
11 | 9 | ||
12 | use test_utils::{project_dir, dir_tests, read_text, collect_tests}; | 10 | use test_utils::{project_dir, dir_tests, read_text, collect_tests}; |
@@ -25,28 +23,36 @@ fn lexer_tests() { | |||
25 | 23 | ||
26 | #[test] | 24 | #[test] |
27 | fn parser_tests() { | 25 | fn parser_tests() { |
28 | dir_tests(&test_data_dir(), &["parser/inline/ok", "parser/ok"], |text, path| { | 26 | dir_tests( |
29 | let file = SourceFileNode::parse(text); | 27 | &test_data_dir(), |
30 | let errors = file.errors(); | 28 | &["parser/inline/ok", "parser/ok"], |
31 | assert_eq!( | 29 | |text, path| { |
32 | &*errors, | 30 | let file = SourceFileNode::parse(text); |
33 | &[] as &[ra_syntax::SyntaxError], | 31 | let errors = file.errors(); |
34 | "There should be no errors in the file {:?}", | 32 | assert_eq!( |
35 | path.display() | 33 | &*errors, |
36 | ); | 34 | &[] as &[ra_syntax::SyntaxError], |
37 | dump_tree(file.syntax()) | 35 | "There should be no errors in the file {:?}", |
38 | }); | 36 | path.display() |
39 | dir_tests(&test_data_dir(), &["parser/err", "parser/inline/err"], |text, path| { | 37 | ); |
40 | let file = SourceFileNode::parse(text); | 38 | dump_tree(file.syntax()) |
41 | let errors = file.errors(); | 39 | }, |
42 | assert_ne!( | 40 | ); |
43 | &*errors, | 41 | dir_tests( |
44 | &[] as &[ra_syntax::SyntaxError], | 42 | &test_data_dir(), |
45 | "There should be errors in the file {:?}", | 43 | &["parser/err", "parser/inline/err"], |
46 | path.display() | 44 | |text, path| { |
47 | ); | 45 | let file = SourceFileNode::parse(text); |
48 | dump_tree(file.syntax()) | 46 | let errors = file.errors(); |
49 | }); | 47 | assert_ne!( |
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 | ); | ||
50 | } | 56 | } |
51 | 57 | ||
52 | #[test] | 58 | #[test] |