From 7a79cde107ec71abbc7c715e933f29f7a1fb2b95 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 8 Dec 2018 20:54:44 +0300 Subject: account for new layout when collecting tests --- crates/tools/src/main.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'crates/tools/src') diff --git a/crates/tools/src/main.rs b/crates/tools/src/main.rs index 7bd4a2d09..d2a6aa94f 100644 --- a/crates/tools/src/main.rs +++ b/crates/tools/src/main.rs @@ -79,15 +79,21 @@ fn tests_from_dir(dir: &Path) -> Result> { if entry.path().extension().unwrap_or_default() != "rs" { continue; } - let text = fs::read_to_string(entry.path())?; + process_file(&mut res, entry.path())?; + } + let grammar_rs = dir.parent().unwrap().join("grammar.rs"); + process_file(&mut res, &grammar_rs)?; + return Ok(res); + fn process_file(res: &mut HashMap, path: &Path) -> Result<()> { + let text = fs::read_to_string(path)?; for (_, test) in collect_tests(&text) { if let Some(old_test) = res.insert(test.name.clone(), test) { bail!("Duplicate test: {}", old_test.name) } } + Ok(()) } - Ok(res) } fn existing_tests(dir: &Path) -> Result> { -- cgit v1.2.3