diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-12-11 22:17:40 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-12-11 22:17:40 +0000 |
commit | 4998807039095cdfbc8725197dfcec1cc4671da9 (patch) | |
tree | af363d79a9333bcdf35aa346b37cafad5a97c87f /crates/mbe/src/tests.rs | |
parent | c1ef62333819fceebff4414df53f40569e1ca909 (diff) | |
parent | ae29fb021142464684478656e0c65deb912624bc (diff) |
Merge #6813
6813: negative sign matching in mbe matching for literal r=edwin0cheng a=edwin0cheng
Fix #6292
r @jonas-schievink
Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/mbe/src/tests.rs')
-rw-r--r-- | crates/mbe/src/tests.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/crates/mbe/src/tests.rs b/crates/mbe/src/tests.rs index 0796ceee1..843054fe8 100644 --- a/crates/mbe/src/tests.rs +++ b/crates/mbe/src/tests.rs | |||
@@ -1008,11 +1008,20 @@ fn test_literal() { | |||
1008 | parse_macro( | 1008 | parse_macro( |
1009 | r#" | 1009 | r#" |
1010 | macro_rules! foo { | 1010 | macro_rules! foo { |
1011 | ($ type:ty $ lit:literal) => { const VALUE: $ type = $ lit;}; | 1011 | ($ type:ty , $ lit:literal) => { const VALUE: $ type = $ lit;}; |
1012 | } | 1012 | } |
1013 | "#, | 1013 | "#, |
1014 | ) | 1014 | ) |
1015 | .assert_expand_items(r#"foo!(u8 0);"#, r#"const VALUE : u8 = 0 ;"#); | 1015 | .assert_expand_items(r#"foo!(u8,0);"#, r#"const VALUE : u8 = 0 ;"#); |
1016 | |||
1017 | parse_macro( | ||
1018 | r#" | ||
1019 | macro_rules! foo { | ||
1020 | ($ type:ty , $ lit:literal) => { const VALUE: $ type = $ lit;}; | ||
1021 | } | ||
1022 | "#, | ||
1023 | ) | ||
1024 | .assert_expand_items(r#"foo!(i32,-1);"#, r#"const VALUE : i32 = - 1 ;"#); | ||
1016 | } | 1025 | } |
1017 | 1026 | ||
1018 | #[test] | 1027 | #[test] |