diff options
author | kjeremy <[email protected]> | 2019-11-15 22:13:52 +0000 |
---|---|---|
committer | kjeremy <[email protected]> | 2019-11-15 22:13:52 +0000 |
commit | 06984ed1164d7607f89f9a6f4893dd05ec058a99 (patch) | |
tree | 9aeda032ad5e09a6f48e1a4d78945b5783573bb1 /crates/ra_ide_api | |
parent | 60fd260e7fb8c88cb9037377dc75f901a54bbe20 (diff) |
Add a test that uses classify_name
Diffstat (limited to 'crates/ra_ide_api')
-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() |