diff options
Diffstat (limited to 'crates/ra_mbe/src/lib.rs')
-rw-r--r-- | crates/ra_mbe/src/lib.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/crates/ra_mbe/src/lib.rs b/crates/ra_mbe/src/lib.rs index ae8a62036..a143eaa36 100644 --- a/crates/ra_mbe/src/lib.rs +++ b/crates/ra_mbe/src/lib.rs | |||
@@ -209,7 +209,6 @@ impl_froms!(TokenTree: Leaf, Subtree); | |||
209 | 209 | ||
210 | pub(crate) fn assert_expansion(rules: &MacroRules, invocation: &str, expansion: &str) { | 210 | pub(crate) fn assert_expansion(rules: &MacroRules, invocation: &str, expansion: &str) { |
211 | let expanded = expand(rules, invocation); | 211 | let expanded = expand(rules, invocation); |
212 | assert_eq!(expanded.to_string(), expansion); | ||
213 | 212 | ||
214 | let tree = token_tree_to_macro_items(&expanded); | 213 | let tree = token_tree_to_macro_items(&expanded); |
215 | 214 | ||
@@ -786,4 +785,16 @@ MACRO_ITEMS@[0; 40) | |||
786 | ); | 785 | ); |
787 | assert_expansion(&rules, r#"foo! { fn foo() {} }"#, r#"fn foo () {}"#); | 786 | assert_expansion(&rules, r#"foo! { fn foo() {} }"#, r#"fn foo () {}"#); |
788 | } | 787 | } |
788 | |||
789 | #[test] | ||
790 | fn test_lifetime() { | ||
791 | let rules = create_rules( | ||
792 | r#" | ||
793 | macro_rules! foo { | ||
794 | ($ lt:lifetime) => { struct Ref<$ lt>{ s: &$ lt str } } | ||
795 | } | ||
796 | "#, | ||
797 | ); | ||
798 | assert_expansion(&rules, r#"foo!{'a}"#, r#"struct Ref < 'a > {s : & 'a str}"#); | ||
799 | } | ||
789 | } | 800 | } |