aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_mbe/src/lib.rs
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-04-19 12:33:29 +0100
committerEdwin Cheng <[email protected]>2019-04-19 12:33:29 +0100
commit762819864fd78f2e8904a6bde6181b80895db360 (patch)
tree1cade2d6eb97a52785a91258cfd3f03c57fba027 /crates/ra_mbe/src/lib.rs
parent8092b6487f301bf9219c55fc714744fa2616fb9a (diff)
add block matcher
Diffstat (limited to 'crates/ra_mbe/src/lib.rs')
-rw-r--r--crates/ra_mbe/src/lib.rs19
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}