aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_ide/src/references.rs30
-rw-r--r--crates/ra_ide_db/src/marks.rs1
-rw-r--r--crates/ra_ide_db/src/search.rs3
3 files changed, 17 insertions, 17 deletions
diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs
index 6440707d7..8eba13e99 100644
--- a/crates/ra_ide/src/references.rs
+++ b/crates/ra_ide/src/references.rs
@@ -287,7 +287,7 @@ mod tests {
287 287
288 #[test] 288 #[test]
289 fn search_filters_by_range() { 289 fn search_filters_by_range() {
290 covers!(search_filters_by_range); 290 covers!(ra_ide_db::search_filters_by_range);
291 let code = r#" 291 let code = r#"
292 fn foo() { 292 fn foo() {
293 let spam<|> = 92; 293 let spam<|> = 92;
@@ -603,7 +603,10 @@ mod tests {
603 fn check_result(res: ReferenceSearchResult, expected_decl: &str, expected_refs: &[&str]) { 603 fn check_result(res: ReferenceSearchResult, expected_decl: &str, expected_refs: &[&str]) {
604 res.declaration().assert_match(expected_decl); 604 res.declaration().assert_match(expected_decl);
605 assert_eq!(res.references.len(), expected_refs.len()); 605 assert_eq!(res.references.len(), expected_refs.len());
606 res.references().iter().enumerate().for_each(|(i, r)| r.assert_match(expected_refs[i])); 606 res.references()
607 .iter()
608 .enumerate()
609 .for_each(|(i, r)| ref_assert_match(r, expected_refs[i]));
607 } 610 }
608 611
609 impl Declaration { 612 impl Declaration {
@@ -621,21 +624,16 @@ mod tests {
621 } 624 }
622 } 625 }
623 626
624 impl Reference { 627 fn ref_debug_render(r: &Reference) -> String {
625 fn debug_render(&self) -> String { 628 let mut s = format!("{:?} {:?} {:?}", r.file_range.file_id, r.file_range.range, r.kind);
626 let mut s = format!( 629 if let Some(access) = r.access {
627 "{:?} {:?} {:?}", 630 s.push_str(&format!(" {:?}", access));
628 self.file_range.file_id, self.file_range.range, self.kind
629 );
630 if let Some(access) = self.access {
631 s.push_str(&format!(" {:?}", access));
632 }
633 s
634 } 631 }
632 s
633 }
635 634
636 fn assert_match(&self, expected: &str) { 635 fn ref_assert_match(r: &Reference, expected: &str) {
637 let actual = self.debug_render(); 636 let actual = ref_debug_render(r);
638 test_utils::assert_eq_text!(expected.trim(), actual.trim(),); 637 test_utils::assert_eq_text!(expected.trim(), actual.trim(),);
639 }
640 } 638 }
641} 639}
diff --git a/crates/ra_ide_db/src/marks.rs b/crates/ra_ide_db/src/marks.rs
index d088fa257..4f0a22af0 100644
--- a/crates/ra_ide_db/src/marks.rs
+++ b/crates/ra_ide_db/src/marks.rs
@@ -6,4 +6,5 @@ test_utils::marks![
6 goto_def_for_fields 6 goto_def_for_fields
7 goto_def_for_record_fields 7 goto_def_for_record_fields
8 goto_def_for_field_init_shorthand 8 goto_def_for_field_init_shorthand
9 search_filters_by_range
9]; 10];
diff --git a/crates/ra_ide_db/src/search.rs b/crates/ra_ide_db/src/search.rs
index 23dd278b5..0963ea257 100644
--- a/crates/ra_ide_db/src/search.rs
+++ b/crates/ra_ide_db/src/search.rs
@@ -12,6 +12,7 @@ use ra_syntax::{
12 algo::find_node_at_offset, ast, match_ast, AstNode, TextRange, TextUnit, TokenAtOffset, 12 algo::find_node_at_offset, ast, match_ast, AstNode, TextRange, TextUnit, TokenAtOffset,
13}; 13};
14use rustc_hash::FxHashMap; 14use rustc_hash::FxHashMap;
15use test_utils::tested_by;
15 16
16use crate::{ 17use crate::{
17 defs::{classify_name_ref, Definition}, 18 defs::{classify_name_ref, Definition},
@@ -206,7 +207,7 @@ impl Definition {
206 for (idx, _) in text.match_indices(pat) { 207 for (idx, _) in text.match_indices(pat) {
207 let offset = TextUnit::from_usize(idx); 208 let offset = TextUnit::from_usize(idx);
208 if !search_range.contains_inclusive(offset) { 209 if !search_range.contains_inclusive(offset) {
209 // tested_by!(search_filters_by_range); 210 tested_by!(search_filters_by_range; force);
210 continue; 211 continue;
211 } 212 }
212 213