diff options
author | Kevin Mehall <[email protected]> | 2021-03-20 23:43:51 +0000 |
---|---|---|
committer | Kevin Mehall <[email protected]> | 2021-03-20 23:54:57 +0000 |
commit | 0a7f28620a7002f47890c2030862052bcbf25cdb (patch) | |
tree | de1a04ded1589c0a3fa504cba606bfc8d89b3aa2 /crates/mbe/src/tests | |
parent | 0a0e22235b7ad222be1aaa7765b580f4096c9aeb (diff) |
Fix and test edge cases of `_` as ident
Diffstat (limited to 'crates/mbe/src/tests')
-rw-r--r-- | crates/mbe/src/tests/rule.rs | 4 |
1 files changed, 4 insertions, 0 deletions
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() { | |||
12 | } | 12 | } |
13 | 13 | ||
14 | check("($i:ident) => ()"); | 14 | check("($i:ident) => ()"); |
15 | check("($(x),*) => ()"); | ||
16 | check("($(x)_*) => ()"); | ||
17 | check("($(x)i*) => ()"); | ||
15 | check("($($i:ident)*) => ($_)"); | 18 | check("($($i:ident)*) => ($_)"); |
16 | check("($($true:ident)*) => ($true)"); | 19 | check("($($true:ident)*) => ($true)"); |
17 | check("($($false:ident)*) => ($false)"); | 20 | check("($($false:ident)*) => ($false)"); |
@@ -32,6 +35,7 @@ fn test_invalid_arms() { | |||
32 | 35 | ||
33 | check("($i) => ($i)", ParseError::UnexpectedToken("bad fragment specifier 1".into())); | 36 | check("($i) => ($i)", ParseError::UnexpectedToken("bad fragment specifier 1".into())); |
34 | check("($i:) => ($i)", ParseError::UnexpectedToken("bad fragment specifier 1".into())); | 37 | check("($i:) => ($i)", ParseError::UnexpectedToken("bad fragment specifier 1".into())); |
38 | check("($i:_) => ()", ParseError::UnexpectedToken("bad fragment specifier 1".into())); | ||
35 | } | 39 | } |
36 | 40 | ||
37 | fn parse_macro_arm(arm_definition: &str) -> Result<crate::MacroRules, ParseError> { | 41 | fn parse_macro_arm(arm_definition: &str) -> Result<crate::MacroRules, ParseError> { |