From cd45c73b660f85acc9b564e536bc407f0836891d Mon Sep 17 00:00:00 2001 From: vsrs Date: Sat, 16 May 2020 17:25:12 +0300 Subject: JFF, ra_fixture arg name for a code highlighting --- crates/test_utils/src/lib.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'crates/test_utils/src') diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/src/lib.rs index fc5ae8f07..45abfead9 100644 --- a/crates/test_utils/src/lib.rs +++ b/crates/test_utils/src/lib.rs @@ -245,8 +245,8 @@ impl FixtureMeta { /// line 2 /// // - other meta /// ``` -pub fn parse_fixture(fixture: &str) -> Vec { - let fixture = indent_first_line(fixture); +pub fn parse_fixture(ra_fixture: &str) -> Vec { + let fixture = indent_first_line(ra_fixture); let margin = fixture_margin(&fixture); let mut lines = fixture @@ -418,14 +418,16 @@ struct Bar; #[test] fn parse_fixture_gets_full_meta() { - let fixture = r" + let parsed = parse_fixture( + r" //- /lib.rs crate:foo deps:bar,baz cfg:foo=a,bar=b,atom env:OUTDIR=path/to,OTHER=foo - "; - let parsed = parse_fixture(fixture); + mod m; + ", + ); assert_eq!(1, parsed.len()); let parsed = &parsed[0]; - assert_eq!("\n", parsed.text); + assert_eq!("mod m;\n\n", parsed.text); let meta = &parsed.meta; assert_eq!("foo", meta.crate_name().unwrap()); @@ -435,12 +437,12 @@ fn parse_fixture_gets_full_meta() { } /// Same as `parse_fixture`, except it allow empty fixture -pub fn parse_single_fixture(fixture: &str) -> Option { - if !fixture.lines().any(|it| it.trim_start().starts_with("//-")) { +pub fn parse_single_fixture(ra_fixture: &str) -> Option { + if !ra_fixture.lines().any(|it| it.trim_start().starts_with("//-")) { return None; } - let fixtures = parse_fixture(fixture); + let fixtures = parse_fixture(ra_fixture); if fixtures.len() > 1 { panic!("too many fixtures"); } -- cgit v1.2.3