aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r--crates/ra_assists/src/tests.rs13
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 @@
1mod generated; 1mod generated;
2 2
3use std::sync::Arc;
4
5use hir::Semantics; 3use hir::Semantics;
6use ra_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt}; 4use ra_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt};
7use ra_ide_db::{symbol_index::SymbolsDatabase, RootDatabase}; 5use ra_ide_db::RootDatabase;
8use ra_syntax::TextRange; 6use ra_syntax::TextRange;
9use test_utils::{ 7use 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::{
13use crate::{handlers::Handler, Assist, AssistConfig, AssistContext, Assists}; 11use crate::{handlers::Handler, Assist, AssistConfig, AssistContext, Assists};
14 12
15pub(crate) fn with_single_file(text: &str) -> (RootDatabase, FileId) { 13pub(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
23pub(crate) fn check_assist(assist: Handler, ra_fixture_before: &str, ra_fixture_after: &str) { 17pub(crate) fn check_assist(assist: Handler, ra_fixture_before: &str, ra_fixture_after: &str) {
@@ -72,8 +66,7 @@ enum ExpectedResult<'a> {
72 66
73fn check(handler: Handler, before: &str, expected: ExpectedResult) { 67fn 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,