From bc2550b196fbf341ce0168f7dda5498e4d7aaf63 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 28 May 2019 16:59:22 +0300 Subject: update tests --- crates/ra_syntax/tests/test.rs | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'crates/ra_syntax/tests') diff --git a/crates/ra_syntax/tests/test.rs b/crates/ra_syntax/tests/test.rs index 91799f8b5..4b711f271 100644 --- a/crates/ra_syntax/tests/test.rs +++ b/crates/ra_syntax/tests/test.rs @@ -8,7 +8,7 @@ use std::{ }; use test_utils::{project_dir, dir_tests, read_text, collect_tests}; -use ra_syntax::{SourceFile, AstNode, fuzz}; +use ra_syntax::{SourceFile, fuzz}; #[test] fn lexer_tests() { @@ -21,26 +21,21 @@ fn lexer_tests() { #[test] fn parser_tests() { dir_tests(&test_data_dir(), &["parser/inline/ok", "parser/ok"], |text, path| { - let file = SourceFile::parse(text); - let errors = file.errors(); + let parse = SourceFile::parse2(text); + let errors = parse.errors.as_slice(); assert_eq!( - &*errors, + errors, &[] as &[ra_syntax::SyntaxError], "There should be no errors in the file {:?}", - path.display() + path.display(), ); - file.syntax().debug_dump() + parse.debug_dump() }); dir_tests(&test_data_dir(), &["parser/err", "parser/inline/err"], |text, path| { - let file = SourceFile::parse(text); - let errors = file.errors(); - assert_ne!( - &*errors, - &[] as &[ra_syntax::SyntaxError], - "There should be errors in the file {:?}", - path.display() - ); - file.syntax().debug_dump() + let parse = SourceFile::parse2(text); + let errors = parse.errors.as_slice(); + assert!(!errors.is_empty(), "There should be errors in the file {:?}", path.display()); + parse.debug_dump() }); } -- cgit v1.2.3