From 7960c8b27681ebeb72d83930c4a2bbf43a982c52 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 5 Dec 2018 12:17:38 +0300 Subject: restore index-based gotodef --- crates/ra_analysis/tests/tests.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'crates/ra_analysis/tests/tests.rs') diff --git a/crates/ra_analysis/tests/tests.rs b/crates/ra_analysis/tests/tests.rs index fbe89f444..71d20dbe9 100644 --- a/crates/ra_analysis/tests/tests.rs +++ b/crates/ra_analysis/tests/tests.rs @@ -18,6 +18,23 @@ fn get_signature(text: &str) -> (FnSignatureInfo, Option) { analysis.resolve_callable(position).unwrap().unwrap() } +#[test] +fn approximate_resolve_works_in_items() { + let (analysis, pos) = analysis_and_position( + " + //- /lib.rs + struct Foo; + enum E { X(Foo<|>) } + ", + ); + + let symbols = analysis.approximately_resolve_symbol(pos).unwrap(); + assert_eq_dbg( + r#"[(FileId(1), FileSymbol { name: "Foo", node_range: [0; 11), kind: STRUCT_DEF })]"#, + &symbols, + ); +} + #[test] fn test_resolve_module() { let (analysis, pos) = analysis_and_position( -- cgit v1.2.3