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 | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/crates/hir_def/src/macro_expansion_tests/mbe.rs b/crates/hir_def/src/macro_expansion_tests/mbe.rs index 1e3d554b83..09688e16b6 100644 --- a/crates/hir_def/src/macro_expansion_tests/mbe.rs +++ b/crates/hir_def/src/macro_expansion_tests/mbe.rs @@ -48,7 +48,7 @@ macro_rules! m { } #[test] -fn tries_all_branches_matching_token_literally() { +fn tries_all_branches_matching_first_token_literally() { check( r#" macro_rules! m { @@ -70,5 +70,31 @@ mod foo {} fn bar() {} struct Baz; "#]], - ) + ); +} + +#[test] +fn tries_all_branches_matching_last_token_literally() { + check( + r#" +macro_rules! m { + ($ i:ident) => ( mod $ i {} ); + ($ i:ident =) => ( fn $ i() {} ); + ($ i:ident +) => ( struct $ i; ) +} +m! { foo } +m! { bar = } +m! { Baz + } +"#, + expect![[r#" +macro_rules! m { + ($ i:ident) => ( mod $ i {} ); + ($ i:ident =) => ( fn $ i() {} ); + ($ i:ident +) => ( struct $ i; ) +} +mod foo {} +fn bar() {} +struct Baz; +"#]], + ); } |