aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/src/bin/collect-tests.rs15
1 files changed, 9 insertions, 6 deletions
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<Test> {
79 .map(str::trim_left) 79 .map(str::trim_left)
80 .group_by(|line| line.starts_with(prefix)); 80 .group_by(|line| line.starts_with(prefix));
81 81
82 for (is_comment, block) in comment_blocks.into_iter() { 82 'outer: for (is_comment, block) in comment_blocks.into_iter() {
83 if !is_comment { 83 if !is_comment {
84 continue; 84 continue;
85 } 85 }
86 let mut block = block.map(|line| &line[prefix.len()..]); 86 let mut block = block.map(|line| &line[prefix.len()..]);
87 let first = block.next().unwrap(); 87
88 if !first.starts_with("test ") { 88 let name = loop {
89 continue; 89 match block.next() {
90 } 90 Some(line) if line.starts_with("test ") => break line["test ".len()..].to_string(),
91 let name = first["test ".len()..].to_string(); 91 Some(_) => (),
92 None => continue 'outer,
93 }
94 };
92 let text: String = itertools::join(block.chain(::std::iter::once("")), "\n"); 95 let text: String = itertools::join(block.chain(::std::iter::once("")), "\n");
93 assert!(!text.trim().is_empty() && text.ends_with("\n")); 96 assert!(!text.trim().is_empty() && text.ends_with("\n"));
94 res.push(Test { name, text }) 97 res.push(Test { name, text })