diff options
Diffstat (limited to 'crates/ra_ide_api/src/references.rs')
-rw-r--r-- | crates/ra_ide_api/src/references.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/references.rs b/crates/ra_ide_api/src/references.rs index 9cb9433e7..faa88d988 100644 --- a/crates/ra_ide_api/src/references.rs +++ b/crates/ra_ide_api/src/references.rs | |||
@@ -369,6 +369,21 @@ mod tests { | |||
369 | assert_eq!(refs.len(), 2); | 369 | assert_eq!(refs.len(), 2); |
370 | } | 370 | } |
371 | 371 | ||
372 | #[test] | ||
373 | fn test_find_all_refs_macro_def() { | ||
374 | let code = r#" | ||
375 | #[macro_export] | ||
376 | macro_rules! m1<|> { () => (()) } | ||
377 | |||
378 | fn foo() { | ||
379 | m1(); | ||
380 | m1(); | ||
381 | }"#; | ||
382 | |||
383 | let refs = get_all_refs(code); | ||
384 | assert_eq!(refs.len(), 3); | ||
385 | } | ||
386 | |||
372 | fn get_all_refs(text: &str) -> ReferenceSearchResult { | 387 | fn get_all_refs(text: &str) -> ReferenceSearchResult { |
373 | let (analysis, position) = single_file_with_position(text); | 388 | let (analysis, position) = single_file_with_position(text); |
374 | analysis.find_all_refs(position, None).unwrap().unwrap() | 389 | analysis.find_all_refs(position, None).unwrap().unwrap() |