From d39cbeef9181ebb5a81dd9aec1a38033bb16da93 Mon Sep 17 00:00:00 2001 From: Brennan Vincent Date: Sun, 31 May 2020 12:21:45 -0400 Subject: add test --- crates/ra_ide/src/references.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index 96444bf6a..bb40d2043 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs @@ -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 { let (analysis, position) = single_file_with_position(text); analysis.find_all_refs(position, None).unwrap().unwrap() -- cgit v1.2.3