rustdoc: Extract attribute docs from native stuffs

This commit is contained in:
Brian Anderson 2012-02-24 14:22:13 -08:00
parent f053f06973
commit 2576a3c2c9
1 changed files with 13 additions and 0 deletions

View File

@ -93,6 +93,7 @@ fn parse_item_attrs<T:send>(
astsrv::exec(srv) {|ctxt|
let attrs = alt ctxt.ast_map.get(id) {
ast_map::node_item(item, _) { item.attrs }
ast_map::node_native_item(item, _) { item.attrs }
_ {
fail "parse_item_attrs: not an item";
}
@ -113,6 +114,18 @@ fn should_extract_top_mod_attributes() {
assert doc.topmod.desc() == some("test");
}
#[test]
fn should_extract_native_mod_attributes() {
let doc = test::mk_doc("#[doc = \"test\"] native mod a { }");
assert doc.topmod.nmods()[0].desc() == some("test");
}
#[test]
fn should_extract_native_fn_attributes() {
let doc = test::mk_doc("native mod a { #[doc = \"test\"] fn a(); }");
assert doc.topmod.nmods()[0].fns[0].desc() == some("test");
}
fn fold_fn(
fold: fold::fold<astsrv::srv>,
doc: doc::fndoc