diff options
Diffstat (limited to 'crates/ra_analysis/tests/test/main.rs')
-rw-r--r-- | crates/ra_analysis/tests/test/main.rs | 19 |
1 files changed, 18 insertions, 1 deletions
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}; | |||
6 | 6 | ||
7 | use ra_analysis::{ | 7 | use ra_analysis::{ |
8 | mock_analysis::{analysis_and_position, single_file, single_file_with_position, MockAnalysis}, | 8 | mock_analysis::{analysis_and_position, single_file, single_file_with_position, MockAnalysis}, |
9 | AnalysisChange, CrateGraph, FileId, FnSignatureInfo, | 9 | AnalysisChange, CrateGraph, FileId, FnSignatureInfo, Query |
10 | }; | 10 | }; |
11 | 11 | ||
12 | fn get_signature(text: &str) -> (FnSignatureInfo, Option<usize>) { | 12 | fn get_signature(text: &str) -> (FnSignatureInfo, Option<usize>) { |
@@ -531,6 +531,7 @@ fn test_rename_for_mut_param() { | |||
531 | }"#, | 531 | }"#, |
532 | ); | 532 | ); |
533 | } | 533 | } |
534 | |||
534 | fn test_rename(text: &str, new_name: &str, expected: &str) { | 535 | fn test_rename(text: &str, new_name: &str, expected: &str) { |
535 | let (analysis, position) = single_file_with_position(text); | 536 | let (analysis, position) = single_file_with_position(text); |
536 | let edits = analysis.rename(position, new_name).unwrap(); | 537 | let edits = analysis.rename(position, new_name).unwrap(); |
@@ -547,3 +548,19 @@ fn test_rename(text: &str, new_name: &str, expected: &str) { | |||
547 | .apply(&*analysis.file_text(file_id.unwrap())); | 548 | .apply(&*analysis.file_text(file_id.unwrap())); |
548 | assert_eq_text!(expected, &*result); | 549 | assert_eq_text!(expected, &*result); |
549 | } | 550 | } |
551 | |||
552 | #[test] | ||
553 | fn world_symbols_include_stuff_from_macros() { | ||
554 | let (analysis, _) = single_file( | ||
555 | " | ||
556 | salsa::query_group! { | ||
557 | pub trait HirDatabase: SyntaxDatabase {} | ||
558 | } | ||
559 | ", | ||
560 | ); | ||
561 | |||
562 | let mut symbols = analysis.symbol_search(Query::new("Hir".into())).unwrap(); | ||
563 | let s = symbols.pop().unwrap(); | ||
564 | assert_eq!(s.name(), "HirDatabase"); | ||
565 | assert_eq!(s.range(), TextRange::from_to(33.into(), 44.into())); | ||
566 | } | ||