mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
add test
This commit is contained in:
parent
8ef9703740
commit
d39cbeef91
@ -615,6 +615,33 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_find_all_refs_nested_module() {
|
||||||
|
let code = r#"
|
||||||
|
//- /lib.rs
|
||||||
|
mod foo {
|
||||||
|
mod bar;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn f<|>() {}
|
||||||
|
|
||||||
|
//- /foo/bar.rs
|
||||||
|
use crate::f;
|
||||||
|
|
||||||
|
fn g() {
|
||||||
|
f();
|
||||||
|
}
|
||||||
|
"#;
|
||||||
|
|
||||||
|
let (analysis, pos) = analysis_and_position(code);
|
||||||
|
let refs = analysis.find_all_refs(pos, None).unwrap().unwrap();
|
||||||
|
check_result(
|
||||||
|
refs,
|
||||||
|
"f FN_DEF FileId(1) 25..34 28..29 Other",
|
||||||
|
&["FileId(2) 11..12 Other", "FileId(2) 27..28 StructLiteral"],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
fn get_all_refs(text: &str) -> ReferenceSearchResult {
|
fn get_all_refs(text: &str) -> ReferenceSearchResult {
|
||||||
let (analysis, position) = single_file_with_position(text);
|
let (analysis, position) = single_file_with_position(text);
|
||||||
analysis.find_all_refs(position, None).unwrap().unwrap()
|
analysis.find_all_refs(position, None).unwrap().unwrap()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user