Add vis matcher

This commit is contained in:
Edwin Cheng 2019-04-19 21:38:26 +08:00
parent c5983b85fc
commit 87ff908135
6 changed files with 33 additions and 1 deletions

View file

@ -809,4 +809,16 @@ MACRO_ITEMS@[0; 40)
);
assert_expansion(&rules, r#"foo!(u8 0)"#, r#"const VALUE: u8 = 0;"#);
}
#[test]
fn test_vis() {
let rules = create_rules(
r#"
macro_rules! foo {
($ vis:vis $ name:ident) => { $ vis fn $ name() {}};
}
"#,
);
assert_expansion(&rules, r#"foo!(pub foo);"#, r#"pub fn foo() {}"#);
}
}