From 74d827bb8001952f90c85fca3d064fe3096009bd Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 4 Nov 2019 22:21:15 +0300 Subject: Rename MockDatabase -> TestDB Actually working rename is sooo useful! --- crates/ra_assists/src/doc_tests.rs | 4 ++-- crates/ra_assists/src/lib.rs | 32 ++++++++++++++++---------------- 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'crates/ra_assists/src') diff --git a/crates/ra_assists/src/doc_tests.rs b/crates/ra_assists/src/doc_tests.rs index 43194037e..2500a5ab7 100644 --- a/crates/ra_assists/src/doc_tests.rs +++ b/crates/ra_assists/src/doc_tests.rs @@ -5,13 +5,13 @@ mod generated; -use hir::mock::MockDatabase; +use hir::mock::TestDB; use ra_db::{fixture::WithFixture, FileRange}; use test_utils::{assert_eq_text, extract_range_or_offset}; fn check(assist_id: &str, before: &str, after: &str) { let (selection, before) = extract_range_or_offset(before); - let (db, file_id) = MockDatabase::with_single_file(&before); + let (db, file_id) = TestDB::with_single_file(&before); let frange = FileRange { file_id, range: selection.into() }; let (_assist_id, action) = crate::assists(&db, frange) diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs index 13db37d29..85fb72395 100644 --- a/crates/ra_assists/src/lib.rs +++ b/crates/ra_assists/src/lib.rs @@ -146,7 +146,7 @@ mod assists { #[cfg(test)] mod helpers { - use hir::mock::MockDatabase; + use hir::mock::TestDB; use ra_db::{fixture::WithFixture, FileRange}; use ra_syntax::TextRange; use test_utils::{add_cursor, assert_eq_text, extract_offset, extract_range}; @@ -154,12 +154,12 @@ mod helpers { use crate::{Assist, AssistCtx}; pub(crate) fn check_assist( - assist: fn(AssistCtx) -> Option, + assist: fn(AssistCtx) -> Option, before: &str, after: &str, ) { let (before_cursor_pos, before) = extract_offset(before); - let (db, file_id) = MockDatabase::with_single_file(&before); + let (db, file_id) = TestDB::with_single_file(&before); let frange = FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) }; let assist = @@ -182,12 +182,12 @@ mod helpers { } pub(crate) fn check_assist_range( - assist: fn(AssistCtx) -> Option, + assist: fn(AssistCtx) -> Option, before: &str, after: &str, ) { let (range, before) = extract_range(before); - let (db, file_id) = MockDatabase::with_single_file(&before); + let (db, file_id) = TestDB::with_single_file(&before); let frange = FileRange { file_id, range }; let assist = AssistCtx::with_ctx(&db, frange, true, assist).expect("code action is not applicable"); @@ -204,12 +204,12 @@ mod helpers { } pub(crate) fn check_assist_target( - assist: fn(AssistCtx) -> Option, + assist: fn(AssistCtx) -> Option, before: &str, target: &str, ) { let (before_cursor_pos, before) = extract_offset(before); - let (db, file_id) = MockDatabase::with_single_file(&before); + let (db, file_id) = TestDB::with_single_file(&before); let frange = FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) }; let assist = @@ -224,12 +224,12 @@ mod helpers { } pub(crate) fn check_assist_range_target( - assist: fn(AssistCtx) -> Option, + assist: fn(AssistCtx) -> Option, before: &str, target: &str, ) { let (range, before) = extract_range(before); - let (db, file_id) = MockDatabase::with_single_file(&before); + let (db, file_id) = TestDB::with_single_file(&before); let frange = FileRange { file_id, range }; let assist = AssistCtx::with_ctx(&db, frange, true, assist).expect("code action is not applicable"); @@ -243,11 +243,11 @@ mod helpers { } pub(crate) fn check_assist_not_applicable( - assist: fn(AssistCtx) -> Option, + assist: fn(AssistCtx) -> Option, before: &str, ) { let (before_cursor_pos, before) = extract_offset(before); - let (db, file_id) = MockDatabase::with_single_file(&before); + let (db, file_id) = TestDB::with_single_file(&before); let frange = FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) }; let assist = AssistCtx::with_ctx(&db, frange, true, assist); @@ -255,11 +255,11 @@ mod helpers { } pub(crate) fn check_assist_range_not_applicable( - assist: fn(AssistCtx) -> Option, + assist: fn(AssistCtx) -> Option, before: &str, ) { let (range, before) = extract_range(before); - let (db, file_id) = MockDatabase::with_single_file(&before); + let (db, file_id) = TestDB::with_single_file(&before); let frange = FileRange { file_id, range }; let assist = AssistCtx::with_ctx(&db, frange, true, assist); assert!(assist.is_none()); @@ -268,7 +268,7 @@ mod helpers { #[cfg(test)] mod tests { - use hir::mock::MockDatabase; + use hir::mock::TestDB; use ra_db::{fixture::WithFixture, FileRange}; use ra_syntax::TextRange; use test_utils::{extract_offset, extract_range}; @@ -277,7 +277,7 @@ mod tests { fn assist_order_field_struct() { let before = "struct Foo { <|>bar: u32 }"; let (before_cursor_pos, before) = extract_offset(before); - let (db, file_id) = MockDatabase::with_single_file(&before); + let (db, file_id) = TestDB::with_single_file(&before); let frange = FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) }; let assists = super::assists(&db, frange); @@ -298,7 +298,7 @@ mod tests { } }"; let (range, before) = extract_range(before); - let (db, file_id) = MockDatabase::with_single_file(&before); + let (db, file_id) = TestDB::with_single_file(&before); let frange = FileRange { file_id, range }; let assists = super::assists(&db, frange); let mut assists = assists.iter(); -- cgit v1.2.3