aboutsummaryrefslogtreecommitdiff
path: root/tools/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-02-04 10:39:24 +0000
committerAleksey Kladov <[email protected]>2018-02-04 10:53:05 +0000
commita40b715ce1cae4db1b4c3b4c383ee7517d4202c4 (patch)
tree6d18d8c47065ea28bb4414a52855ad1c2407c81b /tools/src
parent5e5313a7c71d8aa873b418575f56d23b2eac6e7f (diff)
G: unsafe impl & trait
Diffstat (limited to 'tools/src')
-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 })