Skip to content

Commit cd45c73

Browse files
committed
JFF, ra_fixture arg name for a code highlighting
1 parent 7e9c7ac commit cd45c73

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

crates/test_utils/src/lib.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ impl FixtureMeta {
245245
/// line 2
246246
/// // - other meta
247247
/// ```
248-
pub fn parse_fixture(fixture: &str) -> Vec<FixtureEntry> {
249-
let fixture = indent_first_line(fixture);
248+
pub fn parse_fixture(ra_fixture: &str) -> Vec<FixtureEntry> {
249+
let fixture = indent_first_line(ra_fixture);
250250
let margin = fixture_margin(&fixture);
251251

252252
let mut lines = fixture
@@ -418,14 +418,16 @@ struct Bar;
418418

419419
#[test]
420420
fn parse_fixture_gets_full_meta() {
421-
let fixture = r"
421+
let parsed = parse_fixture(
422+
r"
422423
//- /lib.rs crate:foo deps:bar,baz cfg:foo=a,bar=b,atom env:OUTDIR=path/to,OTHER=foo
423-
";
424-
let parsed = parse_fixture(fixture);
424+
mod m;
425+
",
426+
);
425427
assert_eq!(1, parsed.len());
426428

427429
let parsed = &parsed[0];
428-
assert_eq!("\n", parsed.text);
430+
assert_eq!("mod m;\n\n", parsed.text);
429431

430432
let meta = &parsed.meta;
431433
assert_eq!("foo", meta.crate_name().unwrap());
@@ -435,12 +437,12 @@ fn parse_fixture_gets_full_meta() {
435437
}
436438

437439
/// Same as `parse_fixture`, except it allow empty fixture
438-
pub fn parse_single_fixture(fixture: &str) -> Option<FixtureEntry> {
439-
if !fixture.lines().any(|it| it.trim_start().starts_with("//-")) {
440+
pub fn parse_single_fixture(ra_fixture: &str) -> Option<FixtureEntry> {
441+
if !ra_fixture.lines().any(|it| it.trim_start().starts_with("//-")) {
440442
return None;
441443
}
442444

443-
let fixtures = parse_fixture(fixture);
445+
let fixtures = parse_fixture(ra_fixture);
444446
if fixtures.len() > 1 {
445447
panic!("too many fixtures");
446448
}

0 commit comments

Comments
 (0)