diff options
Diffstat (limited to 'crates/mbe/src/tests.rs')
-rw-r--r-- | crates/mbe/src/tests.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/crates/mbe/src/tests.rs b/crates/mbe/src/tests.rs index f1eadcd1e..5c641ebf2 100644 --- a/crates/mbe/src/tests.rs +++ b/crates/mbe/src/tests.rs | |||
@@ -457,6 +457,17 @@ fn test_match_group_with_multichar_sep() { | |||
457 | } | 457 | } |
458 | 458 | ||
459 | #[test] | 459 | #[test] |
460 | fn test_match_group_with_multichar_sep2() { | ||
461 | parse_macro( | ||
462 | r#" | ||
463 | macro_rules! foo { | ||
464 | (fn $name:ident {$($i:literal)&&*} ) => ( fn $name() -> bool { $($i)&&*} ); | ||
465 | }"#, | ||
466 | ) | ||
467 | .assert_expand_items("foo! (fn baz {true && true} );", "fn baz () -> bool {true &&true}"); | ||
468 | } | ||
469 | |||
470 | #[test] | ||
460 | fn test_match_group_zero_match() { | 471 | fn test_match_group_zero_match() { |
461 | parse_macro( | 472 | parse_macro( |
462 | r#" | 473 | r#" |
@@ -1267,6 +1278,18 @@ macro_rules! m { | |||
1267 | .is_some()); | 1278 | .is_some()); |
1268 | } | 1279 | } |
1269 | 1280 | ||
1281 | #[test] | ||
1282 | fn test_match_is_not_greedy() { | ||
1283 | parse_macro( | ||
1284 | r#" | ||
1285 | macro_rules! foo { | ||
1286 | ($($i:ident $(,)*),*) => {}; | ||
1287 | } | ||
1288 | "#, | ||
1289 | ) | ||
1290 | .assert_expand_items(r#"foo!(a,b);"#, r#""#); | ||
1291 | } | ||
1292 | |||
1270 | // The following tests are based on real world situations | 1293 | // The following tests are based on real world situations |
1271 | #[test] | 1294 | #[test] |
1272 | fn test_vec() { | 1295 | fn test_vec() { |