diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/test_utils/src/lib.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/src/lib.rs index 87778fd04..265fcf8da 100644 --- a/crates/test_utils/src/lib.rs +++ b/crates/test_utils/src/lib.rs | |||
@@ -169,19 +169,6 @@ pub struct FixtureEntry { | |||
169 | /// // - other meta | 169 | /// // - other meta |
170 | /// ``` | 170 | /// ``` |
171 | pub fn parse_fixture(fixture: &str) -> Vec<FixtureEntry> { | 171 | pub fn parse_fixture(fixture: &str) -> Vec<FixtureEntry> { |
172 | let mut res = Vec::new(); | ||
173 | let mut buf = String::new(); | ||
174 | let mut meta: Option<&str> = None; | ||
175 | |||
176 | macro_rules! flush { | ||
177 | () => { | ||
178 | if let Some(meta) = meta { | ||
179 | res.push(FixtureEntry { meta: meta.to_string(), text: buf.clone() }); | ||
180 | buf.clear(); | ||
181 | } | ||
182 | }; | ||
183 | }; | ||
184 | |||
185 | let margin = fixture | 172 | let margin = fixture |
186 | .lines() | 173 | .lines() |
187 | .filter(|it| it.trim_start().starts_with("//-")) | 174 | .filter(|it| it.trim_start().starts_with("//-")) |
@@ -201,6 +188,19 @@ pub fn parse_fixture(fixture: &str) -> Vec<FixtureEntry> { | |||
201 | } | 188 | } |
202 | }); | 189 | }); |
203 | 190 | ||
191 | let mut res = Vec::new(); | ||
192 | let mut buf = String::new(); | ||
193 | let mut meta: Option<&str> = None; | ||
194 | |||
195 | macro_rules! flush { | ||
196 | () => { | ||
197 | if let Some(meta) = meta { | ||
198 | res.push(FixtureEntry { meta: meta.to_string(), text: buf.clone() }); | ||
199 | buf.clear(); | ||
200 | } | ||
201 | }; | ||
202 | }; | ||
203 | |||
204 | for line in lines { | 204 | for line in lines { |
205 | if line.starts_with("//-") { | 205 | if line.starts_with("//-") { |
206 | flush!(); | 206 | flush!(); |