mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
mbe: Ensure repetition separator matches
This commit is contained in:
parent
0000f00787
commit
a4b473226b
2 changed files with 30 additions and 2 deletions
|
@ -256,4 +256,28 @@ impl_froms!(TokenTree: Leaf, Subtree);
|
|||
assert_expansion(&rules, "foo! { eggs Baz }", "struct Baz ;");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_match_group_pattern_by_separator_token() {
|
||||
let rules = create_rules(
|
||||
r#"
|
||||
macro_rules! foo {
|
||||
($ ($ i:ident),*) => ($ (
|
||||
mod $ i {}
|
||||
)*);
|
||||
($ ($ i:ident)#*) => ($ (
|
||||
fn $ i() {}
|
||||
)*);
|
||||
($ i:ident ,# $ j:ident) => (
|
||||
struct $ i;
|
||||
struct $ j;
|
||||
)
|
||||
}
|
||||
"#,
|
||||
);
|
||||
|
||||
assert_expansion(&rules, "foo! { foo, bar }", "mod foo {} mod bar {}");
|
||||
assert_expansion(&rules, "foo! { foo# bar }", "fn foo () {} fn bar () {}");
|
||||
assert_expansion(&rules, "foo! { Foo,# Bar }", "struct Foo ; struct Bar ;");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue