aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/expand_macro.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/expand_macro.rs')
-rw-r--r--crates/ra_ide_api/src/expand_macro.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/expand_macro.rs b/crates/ra_ide_api/src/expand_macro.rs
index 0b540b8cd..abc602244 100644
--- a/crates/ra_ide_api/src/expand_macro.rs
+++ b/crates/ra_ide_api/src/expand_macro.rs
@@ -269,4 +269,27 @@ fn some_thing() -> u32 {
269 assert_eq!(res.name, "foo"); 269 assert_eq!(res.name, "foo");
270 assert_snapshot!(res.expansion, @r###"bar!()"###); 270 assert_snapshot!(res.expansion, @r###"bar!()"###);
271 } 271 }
272
273 #[test]
274 fn macro_expand_with_dollar_crate() {
275 let res = check_expand_macro(
276 r#"
277 //- /lib.rs
278 #[macro_export]
279 macro_rules! bar {
280 () => {0};
281 }
282 macro_rules! foo {
283 () => {$crate::bar!()};
284 }
285
286 fn main() {
287 let res = fo<|>o!();
288 }
289 "#,
290 );
291
292 assert_eq!(res.name, "foo");
293 assert_snapshot!(res.expansion, @r###"0"###);
294 }
272} 295}