From e5101ae150db5faa7ddf8393e375032ef371f5e5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 24 Jun 2020 00:30:34 +0200 Subject: Centralize fixture parsing for assists --- crates/test_utils/src/fixture.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'crates/test_utils') diff --git a/crates/test_utils/src/fixture.rs b/crates/test_utils/src/fixture.rs index 8747fa4a5..7e93fbcd6 100644 --- a/crates/test_utils/src/fixture.rs +++ b/crates/test_utils/src/fixture.rs @@ -30,7 +30,9 @@ impl Fixture { let mut res: Vec = Vec::new(); - for (ix, line) in lines_with_ends(&fixture).enumerate() { + let default = if ra_fixture.contains("//-") { None } else { Some("//- /main.rs") }; + + for (ix, line) in default.into_iter().chain(lines_with_ends(&fixture)).enumerate() { if line.contains("//-") { assert!( line.starts_with("//-"), -- cgit v1.2.3