aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/goto_definition.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/goto_definition.rs')
-rw-r--r--crates/ra_ide/src/goto_definition.rs24
1 files changed, 22 insertions, 2 deletions
diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs
index 502fcb0cf..8aed94d16 100644
--- a/crates/ra_ide/src/goto_definition.rs
+++ b/crates/ra_ide/src/goto_definition.rs
@@ -104,6 +104,9 @@ mod tests {
104 let (analysis, pos) = analysis_and_position(ra_fixture); 104 let (analysis, pos) = analysis_and_position(ra_fixture);
105 105
106 let mut navs = analysis.goto_definition(pos).unwrap().unwrap().info; 106 let mut navs = analysis.goto_definition(pos).unwrap().unwrap().info;
107 if navs.len() == 0 {
108 panic!("unresolved reference")
109 }
107 assert_eq!(navs.len(), 1); 110 assert_eq!(navs.len(), 1);
108 111
109 let nav = navs.pop().unwrap(); 112 let nav = navs.pop().unwrap();
@@ -359,7 +362,7 @@ mod tests {
359 fn goto_def_for_fields() { 362 fn goto_def_for_fields() {
360 covers!(ra_ide_db::goto_def_for_fields); 363 covers!(ra_ide_db::goto_def_for_fields);
361 check_goto( 364 check_goto(
362 " 365 r"
363 //- /lib.rs 366 //- /lib.rs
364 struct Foo { 367 struct Foo {
365 spam: u32, 368 spam: u32,
@@ -378,7 +381,7 @@ mod tests {
378 fn goto_def_for_record_fields() { 381 fn goto_def_for_record_fields() {
379 covers!(ra_ide_db::goto_def_for_record_fields); 382 covers!(ra_ide_db::goto_def_for_record_fields);
380 check_goto( 383 check_goto(
381 " 384 r"
382 //- /lib.rs 385 //- /lib.rs
383 struct Foo { 386 struct Foo {
384 spam: u32, 387 spam: u32,
@@ -396,6 +399,23 @@ mod tests {
396 } 399 }
397 400
398 #[test] 401 #[test]
402 fn goto_def_for_record_fields_macros() {
403 check_goto(
404 r"
405 //- /lib.rs
406 macro_rules! m { () => { 92 };}
407 struct Foo { spam: u32 }
408
409 fn bar() -> Foo {
410 Foo { spam<|>: m!() }
411 }
412 ",
413 "spam RECORD_FIELD_DEF FileId(1) [45; 54) [45; 49)",
414 "spam: u32|spam",
415 );
416 }
417
418 #[test]
399 fn goto_for_tuple_fields() { 419 fn goto_for_tuple_fields() {
400 check_goto( 420 check_goto(
401 " 421 "