aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/tests/test
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-03 18:28:35 +0000
committerAleksey Kladov <[email protected]>2019-01-03 18:29:17 +0000
commitd61707b4e1f0bdfc7f62b1abf78fdc45c0128699 (patch)
tree5a278ad534d2de9f308bbdfef323c3b20bf9a653 /crates/ra_analysis/tests/test
parentebd7c04faa27564ca3f03eed6d4a3636b7d3fc4c (diff)
index stuff produced by macros
Diffstat (limited to 'crates/ra_analysis/tests/test')
-rw-r--r--crates/ra_analysis/tests/test/main.rs19
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
7use ra_analysis::{ 7use 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
12fn get_signature(text: &str) -> (FnSignatureInfo, Option<usize>) { 12fn get_signature(text: &str) -> (FnSignatureInfo, Option<usize>) {
@@ -531,6 +531,7 @@ fn test_rename_for_mut_param() {
531 }"#, 531 }"#,
532 ); 532 );
533} 533}
534
534fn test_rename(text: &str, new_name: &str, expected: &str) { 535fn 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]
553fn world_symbols_include_stuff_from_macros() {
554 let (analysis, _) = single_file(
555 "
556salsa::query_group! {
557pub 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}