diff options
Diffstat (limited to 'crates/ra_mbe/src/lib.rs')
-rw-r--r-- | crates/ra_mbe/src/lib.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/crates/ra_mbe/src/lib.rs b/crates/ra_mbe/src/lib.rs index 8e3167e55..d7462d09d 100644 --- a/crates/ra_mbe/src/lib.rs +++ b/crates/ra_mbe/src/lib.rs | |||
@@ -743,4 +743,23 @@ MACRO_ITEMS@[0; 40) | |||
743 | ); | 743 | ); |
744 | assert_expansion(&rules, "foo! { { 1; } }", "fn foo () {1 ;}"); | 744 | assert_expansion(&rules, "foo! { { 1; } }", "fn foo () {1 ;}"); |
745 | } | 745 | } |
746 | |||
747 | #[test] | ||
748 | fn test_meta() { | ||
749 | let rules = create_rules( | ||
750 | r#" | ||
751 | macro_rules! foo { | ||
752 | ($ i:meta) => ( | ||
753 | #[$ i] | ||
754 | fn bar() {} | ||
755 | ) | ||
756 | } | ||
757 | "#, | ||
758 | ); | ||
759 | assert_expansion( | ||
760 | &rules, | ||
761 | r#"foo! { cfg(target_os = "windows") }"#, | ||
762 | r#"# [cfg (target_os = "windows")] fn bar () {}"#, | ||
763 | ); | ||
764 | } | ||
746 | } | 765 | } |