diff options
Diffstat (limited to 'crates/ra_assists')
-rw-r--r-- | crates/ra_assists/src/tests.rs | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/crates/ra_assists/src/tests.rs b/crates/ra_assists/src/tests.rs index 62dd3547f..55576813f 100644 --- a/crates/ra_assists/src/tests.rs +++ b/crates/ra_assists/src/tests.rs | |||
@@ -1,10 +1,8 @@ | |||
1 | mod generated; | 1 | mod generated; |
2 | 2 | ||
3 | use std::sync::Arc; | ||
4 | |||
5 | use hir::Semantics; | 3 | use hir::Semantics; |
6 | use ra_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt}; | 4 | use ra_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt}; |
7 | use ra_ide_db::{symbol_index::SymbolsDatabase, RootDatabase}; | 5 | use ra_ide_db::RootDatabase; |
8 | use ra_syntax::TextRange; | 6 | use ra_syntax::TextRange; |
9 | use test_utils::{ | 7 | use test_utils::{ |
10 | assert_eq_text, extract_offset, extract_range, extract_range_or_offset, RangeOrOffset, | 8 | assert_eq_text, extract_offset, extract_range, extract_range_or_offset, RangeOrOffset, |
@@ -13,11 +11,7 @@ use test_utils::{ | |||
13 | use crate::{handlers::Handler, Assist, AssistConfig, AssistContext, Assists}; | 11 | use crate::{handlers::Handler, Assist, AssistConfig, AssistContext, Assists}; |
14 | 12 | ||
15 | pub(crate) fn with_single_file(text: &str) -> (RootDatabase, FileId) { | 13 | pub(crate) fn with_single_file(text: &str) -> (RootDatabase, FileId) { |
16 | let (mut db, file_id) = RootDatabase::with_single_file(text); | 14 | RootDatabase::with_single_file(text) |
17 | // FIXME: ideally, this should be done by the above `RootDatabase::with_single_file`, | ||
18 | // but it looks like this might need specialization? :( | ||
19 | db.set_local_roots(Arc::new(vec![db.file_source_root(file_id)])); | ||
20 | (db, file_id) | ||
21 | } | 15 | } |
22 | 16 | ||
23 | pub(crate) fn check_assist(assist: Handler, ra_fixture_before: &str, ra_fixture_after: &str) { | 17 | pub(crate) fn check_assist(assist: Handler, ra_fixture_before: &str, ra_fixture_after: &str) { |
@@ -72,8 +66,7 @@ enum ExpectedResult<'a> { | |||
72 | 66 | ||
73 | fn check(handler: Handler, before: &str, expected: ExpectedResult) { | 67 | fn check(handler: Handler, before: &str, expected: ExpectedResult) { |
74 | let (text_without_caret, file_with_caret_id, range_or_offset, db) = if before.contains("//-") { | 68 | let (text_without_caret, file_with_caret_id, range_or_offset, db) = if before.contains("//-") { |
75 | let (mut db, position) = RootDatabase::with_position(before); | 69 | let (db, position) = RootDatabase::with_position(before); |
76 | db.set_local_roots(Arc::new(vec![db.file_source_root(position.file_id)])); | ||
77 | ( | 70 | ( |
78 | db.file_text(position.file_id).as_ref().to_owned(), | 71 | db.file_text(position.file_id).as_ref().to_owned(), |
79 | position.file_id, | 72 | position.file_id, |