Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/expand_macro.rs')
-rw-r--r--crates/ide/src/expand_macro.rs20
1 files changed, 19 insertions, 1 deletions
diff --git a/crates/ide/src/expand_macro.rs b/crates/ide/src/expand_macro.rs
index e4061016e6..a578aba01f 100644
--- a/crates/ide/src/expand_macro.rs
+++ b/crates/ide/src/expand_macro.rs
@@ -238,6 +238,24 @@ fn main() {
}
#[test]
+ fn macro_expand_underscore() {
+ check(
+ r#"
+macro_rules! bar {
+ ($i:tt) => { for _ in 0..$i {} }
+}
+fn main() {
+ ba$0r!(42);
+}
+"#,
+ expect![[r#"
+ bar
+ for _ in 0..42{}
+ "#]],
+ );
+ }
+
+ #[test]
fn macro_expand_recursive_expansion() {
check(
r#"
@@ -385,7 +403,7 @@ fn main() {
"#,
expect![[r#"
foo
- 0 "#]],
+ 0"#]],
);
}