mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-14 22:24:14 +00:00
add tests for goto on tuple fields
This commit is contained in:
parent
6c133017a8
commit
4f7da04c67
2 changed files with 33 additions and 1 deletions
|
@ -446,6 +446,22 @@ mod tests {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn goto_for_tuple_fields() {
|
||||||
|
check_goto(
|
||||||
|
"
|
||||||
|
//- /lib.rs
|
||||||
|
struct Foo(u32);
|
||||||
|
|
||||||
|
fn bar() {
|
||||||
|
let foo = Foo(0);
|
||||||
|
foo.<|>0;
|
||||||
|
}
|
||||||
|
",
|
||||||
|
"TUPLE_FIELD_DEF FileId(1) [11; 14)",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn goto_definition_works_for_ufcs_inherent_methods() {
|
fn goto_definition_works_for_ufcs_inherent_methods() {
|
||||||
check_goto(
|
check_goto(
|
||||||
|
|
|
@ -104,7 +104,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn goto_type_definition_works_param() {
|
fn goto_type_definition_for_param() {
|
||||||
check_goto(
|
check_goto(
|
||||||
"
|
"
|
||||||
//- /lib.rs
|
//- /lib.rs
|
||||||
|
@ -114,4 +114,20 @@ mod tests {
|
||||||
"Foo STRUCT_DEF FileId(1) [0; 11) [7; 10)",
|
"Foo STRUCT_DEF FileId(1) [0; 11) [7; 10)",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn goto_type_definition_for_tuple_field() {
|
||||||
|
check_goto(
|
||||||
|
"
|
||||||
|
//- /lib.rs
|
||||||
|
struct Foo;
|
||||||
|
struct Bar(Foo);
|
||||||
|
fn foo() {
|
||||||
|
let bar = Bar(Foo);
|
||||||
|
bar.<|>0;
|
||||||
|
}
|
||||||
|
",
|
||||||
|
"Foo STRUCT_DEF FileId(1) [0; 11) [7; 10)",
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue