aboutsummaryrefslogtreecommitdiff
path: root/tools/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tools/src/lib.rs')
-rw-r--r--tools/src/lib.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/tools/src/lib.rs b/tools/src/lib.rs
index 21a9468bc..5a7d846ff 100644
--- a/tools/src/lib.rs
+++ b/tools/src/lib.rs
@@ -1,7 +1,7 @@
1extern crate itertools; 1extern crate itertools;
2 2
3use std::hash;
4use itertools::Itertools; 3use itertools::Itertools;
4use std::hash;
5 5
6#[derive(Debug)] 6#[derive(Debug)]
7pub struct Test { 7pub struct Test {
@@ -28,18 +28,17 @@ pub fn collect_tests(s: &str) -> Vec<(usize, Test)> {
28 match block.next() { 28 match block.next() {
29 Some((idx, line)) if line.starts_with("test ") => { 29 Some((idx, line)) if line.starts_with("test ") => {
30 break (idx, line["test ".len()..].to_string()) 30 break (idx, line["test ".len()..].to_string())
31 }, 31 }
32 Some(_) => (), 32 Some(_) => (),
33 None => continue 'outer, 33 None => continue 'outer,
34 } 34 }
35 }; 35 };
36 let text: String = itertools::join( 36 let text: String = itertools::join(
37 block.map(|(_, line)| line) 37 block.map(|(_, line)| line).chain(::std::iter::once("")),
38 .chain(::std::iter::once("")), 38 "\n",
39 "\n"
40 ); 39 );
41 assert!(!text.trim().is_empty() && text.ends_with("\n")); 40 assert!(!text.trim().is_empty() && text.ends_with("\n"));
42 res.push((start_line, Test {name, text })) 41 res.push((start_line, Test { name, text }))
43 } 42 }
44 res 43 res
45} 44}