diff options
author | succcubbus <[email protected]> | 2019-12-13 20:59:25 +0000 |
---|---|---|
committer | succcubbus <[email protected]> | 2019-12-13 20:59:25 +0000 |
commit | 4f7da04c6735e1d00fceb6fc6f83542626ce03c9 (patch) | |
tree | e5a40a0fe51c0e369471ddd5f03d2cf852ad6251 | |
parent | 6c133017a80c41db361d7870bf57db3e43c4074a (diff) |
add tests for goto on tuple fields
-rw-r--r-- | crates/ra_ide/src/goto_definition.rs | 16 | ||||
-rw-r--r-- | crates/ra_ide/src/goto_type_definition.rs | 18 |
2 files changed, 33 insertions, 1 deletions
diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs index 96a73675f..30118b43f 100644 --- a/crates/ra_ide/src/goto_definition.rs +++ b/crates/ra_ide/src/goto_definition.rs | |||
@@ -447,6 +447,22 @@ mod tests { | |||
447 | } | 447 | } |
448 | 448 | ||
449 | #[test] | 449 | #[test] |
450 | fn goto_for_tuple_fields() { | ||
451 | check_goto( | ||
452 | " | ||
453 | //- /lib.rs | ||
454 | struct Foo(u32); | ||
455 | |||
456 | fn bar() { | ||
457 | let foo = Foo(0); | ||
458 | foo.<|>0; | ||
459 | } | ||
460 | ", | ||
461 | "TUPLE_FIELD_DEF FileId(1) [11; 14)", | ||
462 | ); | ||
463 | } | ||
464 | |||
465 | #[test] | ||
450 | fn goto_definition_works_for_ufcs_inherent_methods() { | 466 | fn goto_definition_works_for_ufcs_inherent_methods() { |
451 | check_goto( | 467 | check_goto( |
452 | " | 468 | " |
diff --git a/crates/ra_ide/src/goto_type_definition.rs b/crates/ra_ide/src/goto_type_definition.rs index cc1b90925..5501bb742 100644 --- a/crates/ra_ide/src/goto_type_definition.rs +++ b/crates/ra_ide/src/goto_type_definition.rs | |||
@@ -104,7 +104,7 @@ mod tests { | |||
104 | } | 104 | } |
105 | 105 | ||
106 | #[test] | 106 | #[test] |
107 | fn goto_type_definition_works_param() { | 107 | fn goto_type_definition_for_param() { |
108 | check_goto( | 108 | check_goto( |
109 | " | 109 | " |
110 | //- /lib.rs | 110 | //- /lib.rs |
@@ -114,4 +114,20 @@ mod tests { | |||
114 | "Foo STRUCT_DEF FileId(1) [0; 11) [7; 10)", | 114 | "Foo STRUCT_DEF FileId(1) [0; 11) [7; 10)", |
115 | ); | 115 | ); |
116 | } | 116 | } |
117 | |||
118 | #[test] | ||
119 | fn goto_type_definition_for_tuple_field() { | ||
120 | check_goto( | ||
121 | " | ||
122 | //- /lib.rs | ||
123 | struct Foo; | ||
124 | struct Bar(Foo); | ||
125 | fn foo() { | ||
126 | let bar = Bar(Foo); | ||
127 | bar.<|>0; | ||
128 | } | ||
129 | ", | ||
130 | "Foo STRUCT_DEF FileId(1) [0; 11) [7; 10)", | ||
131 | ); | ||
132 | } | ||
117 | } | 133 | } |