From d61707b4e1f0bdfc7f62b1abf78fdc45c0128699 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 3 Jan 2019 21:28:35 +0300 Subject: index stuff produced by macros --- crates/ra_analysis/tests/test/main.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'crates/ra_analysis/tests') diff --git a/crates/ra_analysis/tests/test/main.rs b/crates/ra_analysis/tests/test/main.rs index 23a5799b9..bfdf8aef2 100644 --- a/crates/ra_analysis/tests/test/main.rs +++ b/crates/ra_analysis/tests/test/main.rs @@ -6,7 +6,7 @@ use test_utils::{assert_eq_dbg, assert_eq_text}; use ra_analysis::{ mock_analysis::{analysis_and_position, single_file, single_file_with_position, MockAnalysis}, - AnalysisChange, CrateGraph, FileId, FnSignatureInfo, + AnalysisChange, CrateGraph, FileId, FnSignatureInfo, Query }; fn get_signature(text: &str) -> (FnSignatureInfo, Option) { @@ -531,6 +531,7 @@ fn test_rename_for_mut_param() { }"#, ); } + fn test_rename(text: &str, new_name: &str, expected: &str) { let (analysis, position) = single_file_with_position(text); let edits = analysis.rename(position, new_name).unwrap(); @@ -547,3 +548,19 @@ fn test_rename(text: &str, new_name: &str, expected: &str) { .apply(&*analysis.file_text(file_id.unwrap())); assert_eq_text!(expected, &*result); } + +#[test] +fn world_symbols_include_stuff_from_macros() { + let (analysis, _) = single_file( + " +salsa::query_group! { +pub trait HirDatabase: SyntaxDatabase {} +} + ", + ); + + let mut symbols = analysis.symbol_search(Query::new("Hir".into())).unwrap(); + let s = symbols.pop().unwrap(); + assert_eq!(s.name(), "HirDatabase"); + assert_eq!(s.range(), TextRange::from_to(33.into(), 44.into())); +} -- cgit v1.2.3