From ce674be2176e14e0d57c3a3e9edc315304aa2fde Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sun, 19 Apr 2020 02:45:17 +0800 Subject: [PATCH] Add mbe lifetime split test --- crates/ra_mbe/src/tests.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/crates/ra_mbe/src/tests.rs b/crates/ra_mbe/src/tests.rs index 5d1274d21f..f2a726538c 100644 --- a/crates/ra_mbe/src/tests.rs +++ b/crates/ra_mbe/src/tests.rs @@ -214,6 +214,33 @@ SUBTREE $ ); } +#[test] +fn test_lifetime_split() { + parse_macro( + r#" +macro_rules! foo { + ($($t:tt)*) => { $($t)*} +} +"#, + ) + .assert_expand( + r#"foo!(static bar: &'static str = "hello";);"#, + r#" +SUBTREE $ + IDENT static 17 + IDENT bar 18 + PUNCH : [alone] 19 + PUNCH & [alone] 20 + PUNCH ' [joint] 21 + IDENT static 22 + IDENT str 23 + PUNCH = [alone] 24 + LITERAL "hello" 25 + PUNCH ; [joint] 26 +"#, + ); +} + #[test] fn test_expr_order() { let expanded = parse_macro(