Skip to content

Commit 8042bc1

Browse files
committed
---
yaml --- r: 11762 b: refs/heads/master c: a5368fb h: refs/heads/master v: v3
1 parent 3f31958 commit 8042bc1

File tree

3 files changed

+42
-3
lines changed

3 files changed

+42
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 474ad2e4dee9ae25501d04e513fcb473e6fb969e
2+
refs/heads/master: a5368fb6d841a244ddd6fb7f983b90ac1ce0c9ef
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/rustdoc/markdown_index_pass.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ fn item_to_entry(
5252
config: config::config
5353
) -> doc::index_entry {
5454
let link = alt doc {
55-
doc::modtag(_) if config.output_style == config::doc_per_mod {
55+
doc::modtag(_) | doc::nmodtag(_)
56+
if config.output_style == config::doc_per_mod {
5657
markdown_writer::make_filename(config, doc::itempage(doc))
5758
}
5859
_ {
@@ -148,6 +149,20 @@ fn should_index_mod_contents_multi_page() {
148149
};
149150
}
150151

152+
#[test]
153+
fn should_index_native_mod_pages() {
154+
let doc = test::mk_doc(
155+
config::doc_per_mod,
156+
"native mod a { }"
157+
);
158+
assert option::get(doc.cratemod().index).entries[0] == {
159+
kind: "Native module",
160+
name: "a",
161+
brief: none,
162+
link: "a.html"
163+
};
164+
}
165+
151166
#[test]
152167
fn should_add_brief_desc_to_index() {
153168
let doc = test::mk_doc(

trunk/src/rustdoc/page_pass.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ fn make_doc_from_pages(page_port: page_port) -> doc::doc {
5959
fn find_pages(doc: doc::doc, page_chan: page_chan) {
6060
let fold = fold::fold({
6161
fold_crate: fold_crate,
62-
fold_mod: fold_mod
62+
fold_mod: fold_mod,
63+
fold_nmod: fold_nmod
6364
with *fold::default_any_fold(page_chan)
6465
});
6566
fold.fold_doc(fold, doc);
@@ -106,13 +107,24 @@ fn strip_mod(doc: doc::moddoc) -> doc::moddoc {
106107
items: vec::filter(doc.items) {|item|
107108
alt item {
108109
doc::modtag(_) { false }
110+
doc::nmodtag(_) { false }
109111
_ { true }
110112
}
111113
}
112114
with doc
113115
}
114116
}
115117

118+
fn fold_nmod(
119+
fold: fold::fold<page_chan>,
120+
doc: doc::nmoddoc
121+
) -> doc::nmoddoc {
122+
let doc = fold::default_seq_fold_nmod(fold, doc);
123+
let page = doc::itempage(doc::nmodtag(doc));
124+
comm::send(fold.ctxt, some(page));
125+
ret doc;
126+
}
127+
116128
#[test]
117129
fn should_not_split_the_doc_into_pages_for_doc_per_crate() {
118130
let doc = test::mk_doc_(
@@ -134,6 +146,18 @@ fn should_remove_mods_from_containing_mods() {
134146
assert vec::is_empty(doc.cratemod().mods());
135147
}
136148

149+
#[test]
150+
fn should_make_a_page_for_every_native_mod() {
151+
let doc = test::mk_doc("native mod a { }");
152+
assert doc.pages.nmods()[0].name() == "a";
153+
}
154+
155+
#[test]
156+
fn should_remove_native_mods_from_containing_mods() {
157+
let doc = test::mk_doc("native mod a { }");
158+
assert vec::is_empty(doc.cratemod().nmods());
159+
}
160+
137161
#[cfg(test)]
138162
mod test {
139163
fn mk_doc_(

0 commit comments

Comments
 (0)