Skip to content

Commit e4f7561

Browse files
committed
Clean-up tests after debug!/std-macros change.
The entire testsuite is converted to using info! rather than debug! because some depend on the code within the debug! being trans'd.
1 parent b48e37e commit e4f7561

File tree

218 files changed

+640
-613
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

218 files changed

+640
-613
lines changed

src/librustdoc/astsrv.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ fn should_prune_unconfigured_items() {
140140
let source = ~"#[cfg(shut_up_and_leave_me_alone)]fn a() { }";
141141
do from_str(source) |srv| {
142142
do exec(srv) |ctxt| {
143-
assert!(ctxt.ast.node.module.items.is_empty());
143+
// one item: the __std_macros secret module
144+
assert_eq!(ctxt.ast.node.module.items.len(), 1);
144145
}
145146
}
146147
}

src/librustdoc/attr_pass.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ mod test {
255255
#[test]
256256
fn should_should_extract_mod_attributes() {
257257
let doc = mk_doc(~"#[doc = \"test\"] mod a { }");
258-
assert!(doc.cratemod().mods()[0].desc() == Some(~"test"));
258+
// hidden __std_macros module at the start.
259+
assert!(doc.cratemod().mods()[1].desc() == Some(~"test"));
259260
}
260261
261262
#[test]

src/librustdoc/desc_to_brief_pass.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ mod test {
190190
#[test]
191191
fn should_promote_desc() {
192192
let doc = mk_doc(~"#[doc = \"desc\"] mod m { }");
193-
assert_eq!(doc.cratemod().mods()[0].brief(), Some(~"desc"));
193+
// hidden __std_macros module at the start.
194+
assert_eq!(doc.cratemod().mods()[1].brief(), Some(~"desc"));
194195
}
195196
196197
#[test]

src/librustdoc/markdown_index_pass.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ mod test {
172172
use extract;
173173
use markdown_index_pass::run;
174174
use path_pass;
175+
use prune_hidden_pass;
175176
use super::pandoc_header_id;
176177

177178
fn mk_doc(output_style: config::OutputStyle, source: ~str)
@@ -183,8 +184,10 @@ mod test {
183184
};
184185
let doc = extract::from_srv(srv.clone(), ~"");
185186
let doc = (attr_pass::mk_pass().f)(srv.clone(), doc);
187+
let doc = (prune_hidden_pass::mk_pass().f)(srv.clone(), doc);
186188
let doc = (desc_to_brief_pass::mk_pass().f)(srv.clone(), doc);
187189
let doc = (path_pass::mk_pass().f)(srv.clone(), doc);
190+
188191
run(srv.clone(), doc, config)
189192
}
190193
}
@@ -240,13 +243,13 @@ mod test {
240243
config::DocPerMod,
241244
~"mod a { } fn b() { }"
242245
);
243-
assert!(doc.cratemod().index.get().entries[0] == doc::IndexEntry {
246+
assert_eq!(doc.cratemod().index.get().entries[0], doc::IndexEntry {
244247
kind: ~"Module",
245248
name: ~"a",
246249
brief: None,
247250
link: ~"a.html"
248251
});
249-
assert!(doc.cratemod().index.get().entries[1] == doc::IndexEntry {
252+
assert_eq!(doc.cratemod().index.get().entries[1], doc::IndexEntry {
250253
kind: ~"Function",
251254
name: ~"b",
252255
brief: None,
@@ -260,8 +263,7 @@ mod test {
260263
config::DocPerMod,
261264
~"#[doc = \"test\"] mod a { }"
262265
);
263-
assert!(doc.cratemod().index.get().entries[0].brief
264-
== Some(~"test"));
266+
assert_eq!(doc.cratemod().index.get().entries[0].brief, Some(~"test"));
265267
}
266268
267269
#[test]
@@ -270,12 +272,13 @@ mod test {
270272
config::DocPerCrate,
271273
~"extern { fn b(); }"
272274
);
273-
assert!(doc.cratemod().nmods()[0].index.get().entries[0]
274-
== doc::IndexEntry {
275-
kind: ~"Function",
276-
name: ~"b",
277-
brief: None,
278-
link: ~"#function-b"
279-
});
275+
// hidden __std_macros module at the start.
276+
assert_eq!(doc.cratemod().nmods()[0].index.get().entries[0],
277+
doc::IndexEntry {
278+
kind: ~"Function",
279+
name: ~"b",
280+
brief: None,
281+
link: ~"#function-b"
282+
});
280283
}
281284
}

src/librustdoc/markdown_pass.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ mod test {
529529
use markdown_writer;
530530
use path_pass;
531531
use page_pass;
532+
use prune_hidden_pass;
532533
use sectionalize_pass;
533534
use trim_pass;
534535
use tystr_pass;
@@ -557,6 +558,8 @@ mod test {
557558
debug!("doc (path): %?", doc);
558559
let doc = (attr_pass::mk_pass().f)(srv.clone(), doc);
559560
debug!("doc (attr): %?", doc);
561+
let doc = (prune_hidden_pass::mk_pass().f)(srv.clone(), doc);
562+
debug!("doc (prune_hidden): %?", doc);
560563
let doc = (desc_to_brief_pass::mk_pass().f)(srv.clone(), doc);
561564
debug!("doc (desc_to_brief): %?", doc);
562565
let doc = (unindent_pass::mk_pass().f)(srv.clone(), doc);

src/librustdoc/markdown_writer.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ mod test {
277277
.. config::default_config(&Path("input/test.rc"))
278278
};
279279
let doc = mk_doc(~"", ~"mod a { mod b { } }");
280-
let modb = copy doc.cratemod().mods()[0].mods()[0];
280+
// hidden __std_macros module at the start.
281+
let modb = copy doc.cratemod().mods()[1].mods()[0];
281282
let page = doc::ItemPage(doc::ModTag(modb));
282283
let filename = make_local_filename(&config, page);
283284
assert_eq!(filename, Path("output/dir/a_b.html"));

src/librustdoc/page_pass.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,10 @@ fn fold_nmod(
152152
mod test {
153153
use astsrv;
154154
use config;
155+
use attr_pass;
155156
use doc;
156157
use extract;
158+
use prune_hidden_pass;
157159
use page_pass::run;
158160

159161
fn mk_doc_(
@@ -162,6 +164,8 @@ mod test {
162164
) -> doc::Doc {
163165
do astsrv::from_str(copy source) |srv| {
164166
let doc = extract::from_srv(srv.clone(), ~"");
167+
let doc = (attr_pass::mk_pass().f)(srv.clone(), doc);
168+
let doc = (prune_hidden_pass::mk_pass().f)(srv.clone(), doc);
165169
run(srv.clone(), doc, output_style)
166170
}
167171
}
@@ -182,6 +186,7 @@ mod test {
182186
#[test]
183187
fn should_make_a_page_for_every_mod() {
184188
let doc = mk_doc(~"mod a { }");
189+
// hidden __std_macros module at the start.
185190
assert_eq!(doc.pages.mods()[0].name(), ~"a");
186191
}
187192

src/librustdoc/path_pass.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,11 @@ fn should_record_mod_paths() {
9797
do astsrv::from_str(source) |srv| {
9898
let doc = extract::from_srv(srv.clone(), ~"");
9999
let doc = run(srv.clone(), doc);
100-
assert!(doc.cratemod().mods()[0].mods()[0].mods()[0].path()
101-
== ~[~"a", ~"b"]);
102-
assert!(doc.cratemod().mods()[0].mods()[1].mods()[0].path()
103-
== ~[~"a", ~"d"]);
100+
// hidden __std_macros module at the start.
101+
assert_eq!(doc.cratemod().mods()[1].mods()[0].mods()[0].path(),
102+
~[~"a", ~"b"]);
103+
assert_eq!(doc.cratemod().mods()[1].mods()[1].mods()[0].path(),
104+
~[~"a", ~"d"]);
104105
}
105106
}
106107
@@ -110,6 +111,7 @@ fn should_record_fn_paths() {
110111
do astsrv::from_str(source) |srv| {
111112
let doc = extract::from_srv(srv.clone(), ~"");
112113
let doc = run(srv.clone(), doc);
113-
assert_eq!(doc.cratemod().mods()[0].fns()[0].path(), ~[~"a"]);
114+
// hidden __std_macros module at the start.
115+
assert_eq!(doc.cratemod().mods()[1].fns()[0].path(), ~[~"a"]);
114116
}
115117
}

src/librustdoc/sectionalize_pass.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,14 @@ mod test {
166166
use attr_pass;
167167
use doc;
168168
use extract;
169+
use prune_hidden_pass;
169170
use sectionalize_pass::run;
170171

171172
fn mk_doc(source: ~str) -> doc::Doc {
172173
do astsrv::from_str(copy source) |srv| {
173174
let doc = extract::from_srv(srv.clone(), ~"");
174175
let doc = (attr_pass::mk_pass().f)(srv.clone(), doc);
176+
let doc = (prune_hidden_pass::mk_pass().f)(srv.clone(), doc);
175177
run(srv.clone(), doc)
176178
}
177179
}

src/librustdoc/sort_item_name_pass.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ fn test() {
3131
do astsrv::from_str(source) |srv| {
3232
let doc = extract::from_srv(srv.clone(), ~"");
3333
let doc = (mk_pass().f)(srv.clone(), doc);
34-
assert_eq!(doc.cratemod().items[0].name(), ~"y");
35-
assert_eq!(doc.cratemod().items[1].name(), ~"z");
34+
// hidden __std_macros module at the start.
35+
assert_eq!(doc.cratemod().items[1].name(), ~"y");
36+
assert_eq!(doc.cratemod().items[2].name(), ~"z");
3637
}
3738
}

0 commit comments

Comments
 (0)