aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/test_utils/src/lib.rs29
1 files changed, 8 insertions, 21 deletions
diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/src/lib.rs
index 5666445aa..336c594a6 100644
--- a/crates/test_utils/src/lib.rs
+++ b/crates/test_utils/src/lib.rs
@@ -188,29 +188,16 @@ pub fn parse_fixture(fixture: &str) -> Vec<FixtureEntry> {
188 } 188 }
189 }); 189 });
190 190
191 let mut res = Vec::new(); 191 let mut res: Vec<FixtureEntry> = Vec::new();
192 let mut meta = None; 192 for line in lines.by_ref() {
193 loop { 193 if line.starts_with("//-") {
194 let mut next_meta = None; 194 let meta = line["//-".len()..].trim().to_string();
195 let mut text = String::new(); 195 res.push(FixtureEntry { meta, text: String::new() })
196 for line in lines.by_ref() { 196 } else if let Some(entry) = res.last_mut() {
197 if line.starts_with("//-") { 197 entry.text.push_str(line);
198 next_meta = Some(line["//-".len()..].trim().to_string()); 198 entry.text.push('\n');
199 break;
200 }
201 text.push_str(line);
202 text.push('\n');
203 }
204
205 if let Some(meta) = meta {
206 res.push(FixtureEntry { meta, text });
207 }
208 meta = next_meta;
209 if meta.is_none() {
210 break;
211 } 199 }
212 } 200 }
213
214 res 201 res
215} 202}
216 203