From a40b715ce1cae4db1b4c3b4c383ee7517d4202c4 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 4 Feb 2018 13:39:24 +0300 Subject: G: unsafe impl & trait --- tools/src/bin/collect-tests.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'tools') diff --git a/tools/src/bin/collect-tests.rs b/tools/src/bin/collect-tests.rs index df9d2db81..9a84d92fc 100644 --- a/tools/src/bin/collect-tests.rs +++ b/tools/src/bin/collect-tests.rs @@ -79,16 +79,19 @@ fn collect_tests(s: &str) -> Vec { .map(str::trim_left) .group_by(|line| line.starts_with(prefix)); - for (is_comment, block) in comment_blocks.into_iter() { + 'outer: for (is_comment, block) in comment_blocks.into_iter() { if !is_comment { continue; } let mut block = block.map(|line| &line[prefix.len()..]); - let first = block.next().unwrap(); - if !first.starts_with("test ") { - continue; - } - let name = first["test ".len()..].to_string(); + + let name = loop { + match block.next() { + Some(line) if line.starts_with("test ") => break line["test ".len()..].to_string(), + Some(_) => (), + None => continue 'outer, + } + }; let text: String = itertools::join(block.chain(::std::iter::once("")), "\n"); assert!(!text.trim().is_empty() && text.ends_with("\n")); res.push(Test { name, text }) -- cgit v1.2.3 From d4179550cd69a23a79ed27a96b93f9f760c02b69 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 4 Feb 2018 14:03:42 +0300 Subject: Fix test collection --- tools/src/bin/collect-tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/src/bin/collect-tests.rs b/tools/src/bin/collect-tests.rs index 9a84d92fc..a52e7b119 100644 --- a/tools/src/bin/collect-tests.rs +++ b/tools/src/bin/collect-tests.rs @@ -124,7 +124,7 @@ fn inline_tests_dir() -> PathBuf { } fn grammar_dir() -> PathBuf { - base_dir().join("src/parser/event_parser/grammar") + base_dir().join("src/parser/grammar") } fn base_dir() -> PathBuf { -- cgit v1.2.3