diff options
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/tests.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/tests.rs b/crates/ra_syntax/src/tests.rs index fa5d2d5d8..458920607 100644 --- a/crates/ra_syntax/src/tests.rs +++ b/crates/ra_syntax/src/tests.rs | |||
@@ -16,6 +16,18 @@ fn lexer_tests() { | |||
16 | } | 16 | } |
17 | 17 | ||
18 | #[test] | 18 | #[test] |
19 | fn parse_smoke_test() { | ||
20 | let code = r##" | ||
21 | fn main() { | ||
22 | println!("Hello, world!") | ||
23 | } | ||
24 | "##; | ||
25 | |||
26 | let parse = SourceFile::parse(code); | ||
27 | assert!(parse.ok().is_ok()); | ||
28 | } | ||
29 | |||
30 | #[test] | ||
19 | fn parser_tests() { | 31 | fn parser_tests() { |
20 | dir_tests(&test_data_dir(), &["parser/inline/ok", "parser/ok"], |text, path| { | 32 | dir_tests(&test_data_dir(), &["parser/inline/ok", "parser/ok"], |text, path| { |
21 | let parse = SourceFile::parse(text); | 33 | let parse = SourceFile::parse(text); |
@@ -75,7 +87,9 @@ fn self_hosting_parsing() { | |||
75 | { | 87 | { |
76 | count += 1; | 88 | count += 1; |
77 | let text = read_text(entry.path()); | 89 | let text = read_text(entry.path()); |
78 | SourceFile::parse(&text).ok().expect("There should be no errors in the file"); | 90 | if let Err(errors) = SourceFile::parse(&text).ok() { |
91 | panic!("Parsing errors:\n{:?}\n{}\n", errors, entry.path().display()); | ||
92 | } | ||
79 | } | 93 | } |
80 | assert!( | 94 | assert!( |
81 | count > 30, | 95 | count > 30, |