mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-28 05:53:45 +00:00
Add a test that uses classify_name
This commit is contained in:
parent
60fd260e7f
commit
06984ed116
1 changed files with 15 additions and 0 deletions
|
@ -369,6 +369,21 @@ mod tests {
|
||||||
assert_eq!(refs.len(), 2);
|
assert_eq!(refs.len(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_find_all_refs_macro_def() {
|
||||||
|
let code = r#"
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! m1<|> { () => (()) }
|
||||||
|
|
||||||
|
fn foo() {
|
||||||
|
m1();
|
||||||
|
m1();
|
||||||
|
}"#;
|
||||||
|
|
||||||
|
let refs = get_all_refs(code);
|
||||||
|
assert_eq!(refs.len(), 3);
|
||||||
|
}
|
||||||
|
|
||||||
fn get_all_refs(text: &str) -> ReferenceSearchResult {
|
fn get_all_refs(text: &str) -> ReferenceSearchResult {
|
||||||
let (analysis, position) = single_file_with_position(text);
|
let (analysis, position) = single_file_with_position(text);
|
||||||
analysis.find_all_refs(position, None).unwrap().unwrap()
|
analysis.find_all_refs(position, None).unwrap().unwrap()
|
||||||
|
|
Loading…
Reference in a new issue