From 0a7f28620a7002f47890c2030862052bcbf25cdb Mon Sep 17 00:00:00 2001 From: Kevin Mehall Date: Sat, 20 Mar 2021 17:43:51 -0600 Subject: Fix and test edge cases of `_` as ident --- crates/mbe/src/tests/rule.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'crates/mbe/src/tests') diff --git a/crates/mbe/src/tests/rule.rs b/crates/mbe/src/tests/rule.rs index 07277966d..bf48112b3 100644 --- a/crates/mbe/src/tests/rule.rs +++ b/crates/mbe/src/tests/rule.rs @@ -12,6 +12,9 @@ fn test_valid_arms() { } check("($i:ident) => ()"); + check("($(x),*) => ()"); + check("($(x)_*) => ()"); + check("($(x)i*) => ()"); check("($($i:ident)*) => ($_)"); check("($($true:ident)*) => ($true)"); check("($($false:ident)*) => ($false)"); @@ -32,6 +35,7 @@ fn test_invalid_arms() { check("($i) => ($i)", ParseError::UnexpectedToken("bad fragment specifier 1".into())); check("($i:) => ($i)", ParseError::UnexpectedToken("bad fragment specifier 1".into())); + check("($i:_) => ()", ParseError::UnexpectedToken("bad fragment specifier 1".into())); } fn parse_macro_arm(arm_definition: &str) -> Result { -- cgit v1.2.3