mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Add tests
This commit is contained in:
parent
e8741b9d75
commit
1630a34c3f
1 changed files with 40 additions and 0 deletions
|
@ -345,6 +345,46 @@ mod tests {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn goto_definition_works_for_macro_defined_fn_with_arg() {
|
||||||
|
check_goto(
|
||||||
|
"
|
||||||
|
//- /lib.rs
|
||||||
|
macro_rules! define_fn {
|
||||||
|
($name:ident) => (fn $name() {})
|
||||||
|
}
|
||||||
|
|
||||||
|
define_fn!(
|
||||||
|
foo
|
||||||
|
)
|
||||||
|
|
||||||
|
fn bar() {
|
||||||
|
<|>foo();
|
||||||
|
}
|
||||||
|
",
|
||||||
|
"foo FN_DEF FileId(1) [80; 83) [80; 83)",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn goto_definition_works_for_macro_defined_fn_no_arg() {
|
||||||
|
check_goto(
|
||||||
|
"
|
||||||
|
//- /lib.rs
|
||||||
|
macro_rules! define_fn {
|
||||||
|
() => (fn foo() {})
|
||||||
|
}
|
||||||
|
|
||||||
|
define_fn!();
|
||||||
|
|
||||||
|
fn bar() {
|
||||||
|
<|>foo();
|
||||||
|
}
|
||||||
|
",
|
||||||
|
"foo FN_DEF FileId(1) [39; 42) [39; 42)",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn goto_definition_works_for_methods() {
|
fn goto_definition_works_for_methods() {
|
||||||
covers!(goto_definition_works_for_methods);
|
covers!(goto_definition_works_for_methods);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue