Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir_def/src/macro_expansion_tests/mbe.rs')
| -rw-r--r-- | crates/hir_def/src/macro_expansion_tests/mbe.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/crates/hir_def/src/macro_expansion_tests/mbe.rs b/crates/hir_def/src/macro_expansion_tests/mbe.rs index bb39dd4492..c57e9cd838 100644 --- a/crates/hir_def/src/macro_expansion_tests/mbe.rs +++ b/crates/hir_def/src/macro_expansion_tests/mbe.rs @@ -124,3 +124,38 @@ struct Baz; "#]], ); } + +#[test] +fn match_by_separator_token() { + check( + r#" +macro_rules! m { + ($ ($ i:ident),*) => ($ ( mod $ i {} )*); + ($ ($ i:ident)#*) => ($ ( fn $ i() {} )*); + ($ i:ident ,# $ j:ident) => ( struct $ i; struct $ j; ) +} + +m! { foo, bar } + +m! { foo# bar } + +m! { Foo,# Bar } +"#, + expect![[r##" +macro_rules! m { + ($ ($ i:ident),*) => ($ ( mod $ i {} )*); + ($ ($ i:ident)#*) => ($ ( fn $ i() {} )*); + ($ i:ident ,# $ j:ident) => ( struct $ i; struct $ j; ) +} + +mod foo {} +mod bar {} + +fn foo() {} +fn bar() {} + +struct Foo; +struct Bar; +"##]], + ); +} |