add mod doc comments test in ast

This commit is contained in:
csmoe 2019-01-04 21:51:45 +08:00
parent f604ff5b2f
commit a0ef196d04

View File

@ -481,3 +481,16 @@ pub fn op(&self) -> Option<PrefixOp> {
}
}
}
#[test]
fn test_doc_comment_of_items() {
let file = SourceFileNode::parse(
r#"
//! doc
// non-doc
mod foo {}
"#,
);
let module = file.syntax().descendants().find_map(Module::cast).unwrap();
assert_eq!("doc", module.doc_comment_text());
}