(content: &str)
| 141 | } |
| 142 | |
| 143 | fn parse_fixture(content: &str) -> Result<ParsedFixture, String> { |
| 144 | // Split header and body on the first `---` line. |
| 145 | let (header, body) = content |
| 146 | .split_once("\n---\n") |
| 147 | .or_else(|| content.split_once("\n---")) |
| 148 | .ok_or("Fixture missing `---` separator between header and body")?; |
| 149 | |
| 150 | let meta = parse_header(header)?; |
| 151 | let (files, cursor_file, cursor_line, cursor_char) = parse_body(body.trim_start())?; |
| 152 | |
| 153 | Ok(ParsedFixture { |
| 154 | meta, |
| 155 | files, |
| 156 | cursor_file, |
| 157 | cursor_line, |
| 158 | cursor_char, |
| 159 | }) |
| 160 | } |
| 161 | |
| 162 | fn parse_header(header: &str) -> Result<TestMeta, String> { |
| 163 | let mut description = String::new(); |
no test coverage detected