aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-11-04 19:21:15 +0000
committerAleksey Kladov <[email protected]>2019-11-04 19:21:15 +0000
commit74d827bb8001952f90c85fca3d064fe3096009bd (patch)
tree672dfa705dbdd06a167a645b5c5ebea9afe3a57e /crates/ra_assists/src
parent7649a8ebbe900f43cc9b8789c2942cfbadab8f1c (diff)
Rename MockDatabase -> TestDB
Actually working rename is sooo useful!
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r--crates/ra_assists/src/doc_tests.rs4
-rw-r--r--crates/ra_assists/src/lib.rs32
2 files changed, 18 insertions, 18 deletions
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 @@
5 5
6mod generated; 6mod generated;
7 7
8use hir::mock::MockDatabase; 8use hir::mock::TestDB;
9use ra_db::{fixture::WithFixture, FileRange}; 9use ra_db::{fixture::WithFixture, FileRange};
10use test_utils::{assert_eq_text, extract_range_or_offset}; 10use test_utils::{assert_eq_text, extract_range_or_offset};
11 11
12fn check(assist_id: &str, before: &str, after: &str) { 12fn check(assist_id: &str, before: &str, after: &str) {
13 let (selection, before) = extract_range_or_offset(before); 13 let (selection, before) = extract_range_or_offset(before);
14 let (db, file_id) = MockDatabase::with_single_file(&before); 14 let (db, file_id) = TestDB::with_single_file(&before);
15 let frange = FileRange { file_id, range: selection.into() }; 15 let frange = FileRange { file_id, range: selection.into() };
16 16
17 let (_assist_id, action) = crate::assists(&db, frange) 17 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 {
146 146
147#[cfg(test)] 147#[cfg(test)]
148mod helpers { 148mod helpers {
149 use hir::mock::MockDatabase; 149 use hir::mock::TestDB;
150 use ra_db::{fixture::WithFixture, FileRange}; 150 use ra_db::{fixture::WithFixture, FileRange};
151 use ra_syntax::TextRange; 151 use ra_syntax::TextRange;
152 use test_utils::{add_cursor, assert_eq_text, extract_offset, extract_range}; 152 use test_utils::{add_cursor, assert_eq_text, extract_offset, extract_range};
@@ -154,12 +154,12 @@ mod helpers {
154 use crate::{Assist, AssistCtx}; 154 use crate::{Assist, AssistCtx};
155 155
156 pub(crate) fn check_assist( 156 pub(crate) fn check_assist(
157 assist: fn(AssistCtx<MockDatabase>) -> Option<Assist>, 157 assist: fn(AssistCtx<TestDB>) -> Option<Assist>,
158 before: &str, 158 before: &str,
159 after: &str, 159 after: &str,
160 ) { 160 ) {
161 let (before_cursor_pos, before) = extract_offset(before); 161 let (before_cursor_pos, before) = extract_offset(before);
162 let (db, file_id) = MockDatabase::with_single_file(&before); 162 let (db, file_id) = TestDB::with_single_file(&before);
163 let frange = 163 let frange =
164 FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) }; 164 FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) };
165 let assist = 165 let assist =
@@ -182,12 +182,12 @@ mod helpers {
182 } 182 }
183 183
184 pub(crate) fn check_assist_range( 184 pub(crate) fn check_assist_range(
185 assist: fn(AssistCtx<MockDatabase>) -> Option<Assist>, 185 assist: fn(AssistCtx<TestDB>) -> Option<Assist>,
186 before: &str, 186 before: &str,
187 after: &str, 187 after: &str,
188 ) { 188 ) {
189 let (range, before) = extract_range(before); 189 let (range, before) = extract_range(before);
190 let (db, file_id) = MockDatabase::with_single_file(&before); 190 let (db, file_id) = TestDB::with_single_file(&before);
191 let frange = FileRange { file_id, range }; 191 let frange = FileRange { file_id, range };
192 let assist = 192 let assist =
193 AssistCtx::with_ctx(&db, frange, true, assist).expect("code action is not applicable"); 193 AssistCtx::with_ctx(&db, frange, true, assist).expect("code action is not applicable");
@@ -204,12 +204,12 @@ mod helpers {
204 } 204 }
205 205
206 pub(crate) fn check_assist_target( 206 pub(crate) fn check_assist_target(
207 assist: fn(AssistCtx<MockDatabase>) -> Option<Assist>, 207 assist: fn(AssistCtx<TestDB>) -> Option<Assist>,
208 before: &str, 208 before: &str,
209 target: &str, 209 target: &str,
210 ) { 210 ) {
211 let (before_cursor_pos, before) = extract_offset(before); 211 let (before_cursor_pos, before) = extract_offset(before);
212 let (db, file_id) = MockDatabase::with_single_file(&before); 212 let (db, file_id) = TestDB::with_single_file(&before);
213 let frange = 213 let frange =
214 FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) }; 214 FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) };
215 let assist = 215 let assist =
@@ -224,12 +224,12 @@ mod helpers {
224 } 224 }
225 225
226 pub(crate) fn check_assist_range_target( 226 pub(crate) fn check_assist_range_target(
227 assist: fn(AssistCtx<MockDatabase>) -> Option<Assist>, 227 assist: fn(AssistCtx<TestDB>) -> Option<Assist>,
228 before: &str, 228 before: &str,
229 target: &str, 229 target: &str,
230 ) { 230 ) {
231 let (range, before) = extract_range(before); 231 let (range, before) = extract_range(before);
232 let (db, file_id) = MockDatabase::with_single_file(&before); 232 let (db, file_id) = TestDB::with_single_file(&before);
233 let frange = FileRange { file_id, range }; 233 let frange = FileRange { file_id, range };
234 let assist = 234 let assist =
235 AssistCtx::with_ctx(&db, frange, true, assist).expect("code action is not applicable"); 235 AssistCtx::with_ctx(&db, frange, true, assist).expect("code action is not applicable");
@@ -243,11 +243,11 @@ mod helpers {
243 } 243 }
244 244
245 pub(crate) fn check_assist_not_applicable( 245 pub(crate) fn check_assist_not_applicable(
246 assist: fn(AssistCtx<MockDatabase>) -> Option<Assist>, 246 assist: fn(AssistCtx<TestDB>) -> Option<Assist>,
247 before: &str, 247 before: &str,
248 ) { 248 ) {
249 let (before_cursor_pos, before) = extract_offset(before); 249 let (before_cursor_pos, before) = extract_offset(before);
250 let (db, file_id) = MockDatabase::with_single_file(&before); 250 let (db, file_id) = TestDB::with_single_file(&before);
251 let frange = 251 let frange =
252 FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) }; 252 FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) };
253 let assist = AssistCtx::with_ctx(&db, frange, true, assist); 253 let assist = AssistCtx::with_ctx(&db, frange, true, assist);
@@ -255,11 +255,11 @@ mod helpers {
255 } 255 }
256 256
257 pub(crate) fn check_assist_range_not_applicable( 257 pub(crate) fn check_assist_range_not_applicable(
258 assist: fn(AssistCtx<MockDatabase>) -> Option<Assist>, 258 assist: fn(AssistCtx<TestDB>) -> Option<Assist>,
259 before: &str, 259 before: &str,
260 ) { 260 ) {
261 let (range, before) = extract_range(before); 261 let (range, before) = extract_range(before);
262 let (db, file_id) = MockDatabase::with_single_file(&before); 262 let (db, file_id) = TestDB::with_single_file(&before);
263 let frange = FileRange { file_id, range }; 263 let frange = FileRange { file_id, range };
264 let assist = AssistCtx::with_ctx(&db, frange, true, assist); 264 let assist = AssistCtx::with_ctx(&db, frange, true, assist);
265 assert!(assist.is_none()); 265 assert!(assist.is_none());
@@ -268,7 +268,7 @@ mod helpers {
268 268
269#[cfg(test)] 269#[cfg(test)]
270mod tests { 270mod tests {
271 use hir::mock::MockDatabase; 271 use hir::mock::TestDB;
272 use ra_db::{fixture::WithFixture, FileRange}; 272 use ra_db::{fixture::WithFixture, FileRange};
273 use ra_syntax::TextRange; 273 use ra_syntax::TextRange;
274 use test_utils::{extract_offset, extract_range}; 274 use test_utils::{extract_offset, extract_range};
@@ -277,7 +277,7 @@ mod tests {
277 fn assist_order_field_struct() { 277 fn assist_order_field_struct() {
278 let before = "struct Foo { <|>bar: u32 }"; 278 let before = "struct Foo { <|>bar: u32 }";
279 let (before_cursor_pos, before) = extract_offset(before); 279 let (before_cursor_pos, before) = extract_offset(before);
280 let (db, file_id) = MockDatabase::with_single_file(&before); 280 let (db, file_id) = TestDB::with_single_file(&before);
281 let frange = 281 let frange =
282 FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) }; 282 FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) };
283 let assists = super::assists(&db, frange); 283 let assists = super::assists(&db, frange);
@@ -298,7 +298,7 @@ mod tests {
298 } 298 }
299 }"; 299 }";
300 let (range, before) = extract_range(before); 300 let (range, before) = extract_range(before);
301 let (db, file_id) = MockDatabase::with_single_file(&before); 301 let (db, file_id) = TestDB::with_single_file(&before);
302 let frange = FileRange { file_id, range }; 302 let frange = FileRange { file_id, range };
303 let assists = super::assists(&db, frange); 303 let assists = super::assists(&db, frange);
304 let mut assists = assists.iter(); 304 let mut assists = assists.iter();