mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-30 15:17:31 +00:00
Add fixture meta for single file fixture
This commit is contained in:
parent
d53627beba
commit
773f3afd36
3 changed files with 55 additions and 14 deletions
|
@ -202,6 +202,14 @@ pub fn parse_fixture(fixture: &str) -> Vec<FixtureEntry> {
|
|||
res
|
||||
}
|
||||
|
||||
/// Same as `parse_fixture`, except it allow empty fixture
|
||||
pub fn parse_single_fixture(fixture: &str) -> Option<FixtureEntry> {
|
||||
if !fixture.lines().any(|it| it.trim_start().starts_with("//-")) {
|
||||
return None;
|
||||
}
|
||||
parse_fixture(fixture).into_iter().nth(0)
|
||||
}
|
||||
|
||||
// Comparison functionality borrowed from cargo:
|
||||
|
||||
/// Compare a line with an expected pattern.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue