Add a test that uses classify_name

This commit is contained in:
kjeremy 2019-11-15 17:13:52 -05:00
parent 60fd260e7f
commit 06984ed116

View file

@ -369,6 +369,21 @@ mod tests {
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 {
let (analysis, position) = single_file_with_position(text);
analysis.find_all_refs(position, None).unwrap().unwrap()