Add block matcher

This commit is contained in:
Edwin Cheng 2019-04-19 18:30:43 +08:00
parent ab0a96586f
commit 8092b6487f
6 changed files with 35 additions and 0 deletions

View file

@ -731,4 +731,16 @@ MACRO_ITEMS@[0; 40)
}
"#, r#"extern crate a ; mod b ; mod c {} use d ; const E : i32 = 0 ; static F : i32 = 0 ; impl G {} struct H ; enum I {Foo} trait J {} fn h () {} extern {} type T = u8 ;"#);
}
#[test]
fn test_block() {
let rules = create_rules(
r#"
macro_rules! foo {
($ i:block) => { fn foo() $ i }
}
"#,
);
assert_expansion(&rules, "foo! { { 1; } }", "fn foo () {1 ;}");
}
}