aboutsummaryrefslogtreecommitdiff
path: root/crates/test_utils
diff options
context:
space:
mode:
authorVeetaha <[email protected]>2020-01-29 01:53:15 +0000
committerVeetaha <[email protected]>2020-01-29 01:53:15 +0000
commit5e1ae1d7aa9d83406de4881be37b39ed457e3bda (patch)
treeaca4489386365b84485dcbcb174955e8cb39bc20 /crates/test_utils
parentd3472e8ae4a0dc1fbf8616a3a626ee9a9f557058 (diff)
test_utils: move flush!() to its usage as per conversation with @matklad
Diffstat (limited to 'crates/test_utils')
-rw-r--r--crates/test_utils/src/lib.rs26
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/// ```
171pub fn parse_fixture(fixture: &str) -> Vec<FixtureEntry> { 171pub 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!();