diff options
Diffstat (limited to 'crates/ra_ide/src/goto_definition.rs')
-rw-r--r-- | crates/ra_ide/src/goto_definition.rs | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs index 1dfca819d..90e85d419 100644 --- a/crates/ra_ide/src/goto_definition.rs +++ b/crates/ra_ide/src/goto_definition.rs | |||
@@ -93,7 +93,7 @@ pub(crate) fn reference_definition( | |||
93 | 93 | ||
94 | #[cfg(test)] | 94 | #[cfg(test)] |
95 | mod tests { | 95 | mod tests { |
96 | use test_utils::{assert_eq_text, covers}; | 96 | use test_utils::assert_eq_text; |
97 | 97 | ||
98 | use crate::mock_analysis::analysis_and_position; | 98 | use crate::mock_analysis::analysis_and_position; |
99 | 99 | ||
@@ -208,7 +208,6 @@ mod tests { | |||
208 | 208 | ||
209 | #[test] | 209 | #[test] |
210 | fn goto_def_for_macros() { | 210 | fn goto_def_for_macros() { |
211 | covers!(ra_ide_db::goto_def_for_macros); | ||
212 | check_goto( | 211 | check_goto( |
213 | " | 212 | " |
214 | //- /lib.rs | 213 | //- /lib.rs |
@@ -225,7 +224,6 @@ mod tests { | |||
225 | 224 | ||
226 | #[test] | 225 | #[test] |
227 | fn goto_def_for_macros_from_other_crates() { | 226 | fn goto_def_for_macros_from_other_crates() { |
228 | covers!(ra_ide_db::goto_def_for_macros); | ||
229 | check_goto( | 227 | check_goto( |
230 | " | 228 | " |
231 | //- /lib.rs | 229 | //- /lib.rs |
@@ -244,6 +242,38 @@ mod tests { | |||
244 | } | 242 | } |
245 | 243 | ||
246 | #[test] | 244 | #[test] |
245 | fn goto_def_for_use_alias() { | ||
246 | check_goto( | ||
247 | " | ||
248 | //- /lib.rs | ||
249 | use foo as bar<|>; | ||
250 | |||
251 | |||
252 | //- /foo/lib.rs | ||
253 | #[macro_export] | ||
254 | macro_rules! foo { () => { () } }", | ||
255 | "SOURCE_FILE FileId(2) 0..50", | ||
256 | "#[macro_export]\nmacro_rules! foo { () => { () } }\n", | ||
257 | ); | ||
258 | } | ||
259 | |||
260 | #[test] | ||
261 | fn goto_def_for_use_alias_foo_macro() { | ||
262 | check_goto( | ||
263 | " | ||
264 | //- /lib.rs | ||
265 | use foo::foo as bar<|>; | ||
266 | |||
267 | //- /foo/lib.rs | ||
268 | #[macro_export] | ||
269 | macro_rules! foo { () => { () } } | ||
270 | ", | ||
271 | "foo MACRO_CALL FileId(2) 0..49 29..32", | ||
272 | "#[macro_export]\nmacro_rules! foo { () => { () } }|foo", | ||
273 | ); | ||
274 | } | ||
275 | |||
276 | #[test] | ||
247 | fn goto_def_for_macros_in_use_tree() { | 277 | fn goto_def_for_macros_in_use_tree() { |
248 | check_goto( | 278 | check_goto( |
249 | " | 279 | " |
@@ -337,7 +367,6 @@ mod tests { | |||
337 | 367 | ||
338 | #[test] | 368 | #[test] |
339 | fn goto_def_for_methods() { | 369 | fn goto_def_for_methods() { |
340 | covers!(ra_ide_db::goto_def_for_methods); | ||
341 | check_goto( | 370 | check_goto( |
342 | " | 371 | " |
343 | //- /lib.rs | 372 | //- /lib.rs |
@@ -357,7 +386,6 @@ mod tests { | |||
357 | 386 | ||
358 | #[test] | 387 | #[test] |
359 | fn goto_def_for_fields() { | 388 | fn goto_def_for_fields() { |
360 | covers!(ra_ide_db::goto_def_for_fields); | ||
361 | check_goto( | 389 | check_goto( |
362 | r" | 390 | r" |
363 | //- /lib.rs | 391 | //- /lib.rs |
@@ -376,7 +404,6 @@ mod tests { | |||
376 | 404 | ||
377 | #[test] | 405 | #[test] |
378 | fn goto_def_for_record_fields() { | 406 | fn goto_def_for_record_fields() { |
379 | covers!(ra_ide_db::goto_def_for_record_fields); | ||
380 | check_goto( | 407 | check_goto( |
381 | r" | 408 | r" |
382 | //- /lib.rs | 409 | //- /lib.rs |
@@ -397,7 +424,6 @@ mod tests { | |||
397 | 424 | ||
398 | #[test] | 425 | #[test] |
399 | fn goto_def_for_record_pat_fields() { | 426 | fn goto_def_for_record_pat_fields() { |
400 | covers!(ra_ide_db::goto_def_for_record_field_pats); | ||
401 | check_goto( | 427 | check_goto( |
402 | r" | 428 | r" |
403 | //- /lib.rs | 429 | //- /lib.rs |
@@ -754,14 +780,14 @@ mod tests { | |||
754 | #[test] | 780 | #[test] |
755 | fn goto_for_type_param() { | 781 | fn goto_for_type_param() { |
756 | check_goto( | 782 | check_goto( |
757 | " | 783 | r#" |
758 | //- /lib.rs | 784 | //- /lib.rs |
759 | struct Foo<T> { | 785 | struct Foo<T: Clone> { |
760 | t: <|>T, | 786 | t: <|>T, |
761 | } | 787 | } |
762 | ", | 788 | "#, |
763 | "T TYPE_PARAM FileId(1) 11..12", | 789 | "T TYPE_PARAM FileId(1) 11..19 11..12", |
764 | "T", | 790 | "T: Clone|T", |
765 | ); | 791 | ); |
766 | } | 792 | } |
767 | 793 | ||
@@ -840,7 +866,6 @@ mod tests { | |||
840 | 866 | ||
841 | #[test] | 867 | #[test] |
842 | fn goto_def_for_field_init_shorthand() { | 868 | fn goto_def_for_field_init_shorthand() { |
843 | covers!(ra_ide_db::goto_def_for_field_init_shorthand); | ||
844 | check_goto( | 869 | check_goto( |
845 | " | 870 | " |
846 | //- /lib.rs | 871 | //- /lib.rs |