aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/tests/test.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/tests/test.rs')
-rw-r--r--crates/ra_syntax/tests/test.rs29
1 files changed, 11 insertions, 18 deletions
diff --git a/crates/ra_syntax/tests/test.rs b/crates/ra_syntax/tests/test.rs
index 91799f8b5..f31e12588 100644
--- a/crates/ra_syntax/tests/test.rs
+++ b/crates/ra_syntax/tests/test.rs
@@ -8,7 +8,7 @@ use std::{
8}; 8};
9 9
10use test_utils::{project_dir, dir_tests, read_text, collect_tests}; 10use test_utils::{project_dir, dir_tests, read_text, collect_tests};
11use ra_syntax::{SourceFile, AstNode, fuzz}; 11use ra_syntax::{SourceFile, fuzz};
12 12
13#[test] 13#[test]
14fn lexer_tests() { 14fn lexer_tests() {
@@ -21,26 +21,21 @@ fn lexer_tests() {
21#[test] 21#[test]
22fn parser_tests() { 22fn parser_tests() {
23 dir_tests(&test_data_dir(), &["parser/inline/ok", "parser/ok"], |text, path| { 23 dir_tests(&test_data_dir(), &["parser/inline/ok", "parser/ok"], |text, path| {
24 let file = SourceFile::parse(text); 24 let parse = SourceFile::parse(text);
25 let errors = file.errors(); 25 let errors = parse.errors.as_slice();
26 assert_eq!( 26 assert_eq!(
27 &*errors, 27 errors,
28 &[] as &[ra_syntax::SyntaxError], 28 &[] as &[ra_syntax::SyntaxError],
29 "There should be no errors in the file {:?}", 29 "There should be no errors in the file {:?}",
30 path.display() 30 path.display(),
31 ); 31 );
32 file.syntax().debug_dump() 32 parse.debug_dump()
33 }); 33 });
34 dir_tests(&test_data_dir(), &["parser/err", "parser/inline/err"], |text, path| { 34 dir_tests(&test_data_dir(), &["parser/err", "parser/inline/err"], |text, path| {
35 let file = SourceFile::parse(text); 35 let parse = SourceFile::parse(text);
36 let errors = file.errors(); 36 let errors = parse.errors.as_slice();
37 assert_ne!( 37 assert!(!errors.is_empty(), "There should be errors in the file {:?}", path.display());
38 &*errors, 38 parse.debug_dump()
39 &[] as &[ra_syntax::SyntaxError],
40 "There should be errors in the file {:?}",
41 path.display()
42 );
43 file.syntax().debug_dump()
44 }); 39 });
45} 40}
46 41
@@ -83,9 +78,7 @@ fn self_hosting_parsing() {
83 { 78 {
84 count += 1; 79 count += 1;
85 let text = read_text(entry.path()); 80 let text = read_text(entry.path());
86 let node = SourceFile::parse(&text); 81 SourceFile::parse(&text).ok().expect("There should be no errors in the file");
87 let errors = node.errors();
88 assert_eq!(&*errors, &[], "There should be no errors in the file {:?}", entry);
89 } 82 }
90 assert!( 83 assert!(
91 count > 30, 84 count > 30,