aboutsummaryrefslogtreecommitdiff
path: root/crates/mbe/src/tests.rs
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2020-12-11 09:59:04 +0000
committerEdwin Cheng <[email protected]>2020-12-11 09:59:04 +0000
commit175229ab3d3243991aebfad6cf7052c1b5bc4ecf (patch)
treee396b930e21ec66524ba5b69a0e8b385643c5412 /crates/mbe/src/tests.rs
parent41321d96789ed918eebda02ada76758765d19d16 (diff)
negative sign matching in mbe matching for literal
Diffstat (limited to 'crates/mbe/src/tests.rs')
-rw-r--r--crates/mbe/src/tests.rs13
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]