Convert doc comment to attr

This commit is contained in:
Edwin Cheng 2019-05-04 15:00:16 +08:00
parent 11cc8024a1
commit e7e896170a
2 changed files with 95 additions and 3 deletions

View file

@ -867,6 +867,31 @@ fn test_meta() {
);
}
#[test]
fn test_meta_doc_comments() {
let rules = create_rules(
r#"
macro_rules! foo {
($(#[$ i:meta])+) => (
$(#[$ i])+
fn bar() {}
)
}
"#,
);
assert_expansion(
MacroKind::Items,
&rules,
r#"foo! {
/// Single Line Doc 1
/**
MultiLines Doc
*/
}"#,
"# [doc = \" Single Line Doc 1\"] # [doc = \" \\n MultiLines Doc\\n \"] fn bar () {}",
);
}
#[test]
fn test_tt_block() {
let rules = create_rules(