aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_mbe
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_mbe')
-rw-r--r--crates/ra_mbe/src/lib.rs24
-rw-r--r--crates/ra_mbe/src/mbe_parser.rs1
2 files changed, 24 insertions, 1 deletions
diff --git a/crates/ra_mbe/src/lib.rs b/crates/ra_mbe/src/lib.rs
index 2f47e32d3..8d5008d20 100644
--- a/crates/ra_mbe/src/lib.rs
+++ b/crates/ra_mbe/src/lib.rs
@@ -554,6 +554,30 @@ SOURCE_FILE@[0; 40)
554 } 554 }
555 555
556 #[test] 556 #[test]
557 fn test_last_expr() {
558 let rules = create_rules(
559 r#"
560 macro_rules! vec {
561 ($($item:expr),*) => {
562 {
563 let mut v = Vec::new();
564 $(
565 v.push($item);
566 )*
567 v
568 }
569 };
570 }
571"#,
572 );
573 assert_expansion(
574 &rules,
575 "vec!(1,2,3)",
576 "{let mut v = Vec :: new () ; v . push (1) ; v . push (2) ; v . push (3) ; v}",
577 );
578 }
579
580 #[test]
557 fn test_ty() { 581 fn test_ty() {
558 let rules = create_rules( 582 let rules = create_rules(
559 r#" 583 r#"
diff --git a/crates/ra_mbe/src/mbe_parser.rs b/crates/ra_mbe/src/mbe_parser.rs
index e3669f66c..f37c422d3 100644
--- a/crates/ra_mbe/src/mbe_parser.rs
+++ b/crates/ra_mbe/src/mbe_parser.rs
@@ -91,7 +91,6 @@ fn parse_repeat(p: &mut TtCursor) -> Result<crate::Repeat, ParseError> {
91 '?' => crate::RepeatKind::ZeroOrOne, 91 '?' => crate::RepeatKind::ZeroOrOne,
92 _ => return Err(ParseError::Expected(String::from("repeat"))), 92 _ => return Err(ParseError::Expected(String::from("repeat"))),
93 }; 93 };
94 p.bump();
95 Ok(crate::Repeat { subtree, kind, separator }) 94 Ok(crate::Repeat { subtree, kind, separator })
96} 95}
97 96