aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-12-08 17:54:44 +0000
committerAleksey Kladov <[email protected]>2018-12-08 17:54:44 +0000
commit7a79cde107ec71abbc7c715e933f29f7a1fb2b95 (patch)
tree99ebf5670a48b311bd3f0c7f6029522179f406a9 /crates
parent4cbc902fcc9de79893779582dac01351d1137c7f (diff)
account for new layout when collecting tests
Diffstat (limited to 'crates')
-rw-r--r--crates/tools/src/main.rs10
1 files changed, 8 insertions, 2 deletions
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<HashMap<String, Test>> {
79 if entry.path().extension().unwrap_or_default() != "rs" { 79 if entry.path().extension().unwrap_or_default() != "rs" {
80 continue; 80 continue;
81 } 81 }
82 let text = fs::read_to_string(entry.path())?; 82 process_file(&mut res, entry.path())?;
83 }
84 let grammar_rs = dir.parent().unwrap().join("grammar.rs");
85 process_file(&mut res, &grammar_rs)?;
86 return Ok(res);
87 fn process_file(res: &mut HashMap<String, Test>, path: &Path) -> Result<()> {
88 let text = fs::read_to_string(path)?;
83 89
84 for (_, test) in collect_tests(&text) { 90 for (_, test) in collect_tests(&text) {
85 if let Some(old_test) = res.insert(test.name.clone(), test) { 91 if let Some(old_test) = res.insert(test.name.clone(), test) {
86 bail!("Duplicate test: {}", old_test.name) 92 bail!("Duplicate test: {}", old_test.name)
87 } 93 }
88 } 94 }
95 Ok(())
89 } 96 }
90 Ok(res)
91} 97}
92 98
93fn existing_tests(dir: &Path) -> Result<HashMap<String, (PathBuf, Test)>> { 99fn existing_tests(dir: &Path) -> Result<HashMap<String, (PathBuf, Test)>> {