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
}

src/librustdoc/sort_item_type_pass.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,15 @@ fn test() {
5353
do astsrv::from_str(source) |srv| {
5454
let doc = extract::from_srv(srv.clone(), ~"");
5555
let doc = (mk_pass().f)(srv.clone(), doc);
56+
// hidden __std_macros module at the start.
5657
assert_eq!(doc.cratemod().items[0].name(), ~"iconst");
5758
assert_eq!(doc.cratemod().items[1].name(), ~"itype");
5859
assert_eq!(doc.cratemod().items[2].name(), ~"ienum");
5960
assert_eq!(doc.cratemod().items[3].name(), ~"istruct");
6061
assert_eq!(doc.cratemod().items[4].name(), ~"itrait");
6162
assert_eq!(doc.cratemod().items[5].name(), ~"__extensions__");
6263
assert_eq!(doc.cratemod().items[6].name(), ~"ifn");
63-
assert_eq!(doc.cratemod().items[7].name(), ~"imod");
64+
// hidden __std_macros module fits here.
65+
assert_eq!(doc.cratemod().items[8].name(), ~"imod");
6466
}
6567
}

src/librustdoc/sort_pass.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,11 @@ fn test() {
6767
do astsrv::from_str(source) |srv| {
6868
let doc = extract::from_srv(srv.clone(), ~"");
6969
let doc = (mk_pass(~"", name_lteq).f)(srv.clone(), doc);
70-
assert_eq!(doc.cratemod().mods()[0].name(), ~"w");
71-
assert_eq!(doc.cratemod().mods()[1].items[0].name(), ~"x");
72-
assert_eq!(doc.cratemod().mods()[1].items[1].name(), ~"y");
73-
assert_eq!(doc.cratemod().mods()[1].name(), ~"z");
70+
// hidden __std_macros module at the start.
71+
assert_eq!(doc.cratemod().mods()[1].name(), ~"w");
72+
assert_eq!(doc.cratemod().mods()[2].items[0].name(), ~"x");
73+
assert_eq!(doc.cratemod().mods()[2].items[1].name(), ~"y");
74+
assert_eq!(doc.cratemod().mods()[2].name(), ~"z");
7475
}
7576
}
7677
@@ -84,10 +85,11 @@ fn should_be_stable() {
8485
do astsrv::from_str(source) |srv| {
8586
let doc = extract::from_srv(srv.clone(), ~"");
8687
let doc = (mk_pass(~"", always_eq).f)(srv.clone(), doc);
87-
assert_eq!(doc.cratemod().mods()[0].items[0].name(), ~"b");
88-
assert_eq!(doc.cratemod().mods()[1].items[0].name(), ~"d");
88+
// hidden __std_macros module at the start.
89+
assert_eq!(doc.cratemod().mods()[1].items[0].name(), ~"b");
90+
assert_eq!(doc.cratemod().mods()[2].items[0].name(), ~"d");
8991
let doc = (mk_pass(~"", always_eq).f)(srv.clone(), doc);
90-
assert_eq!(doc.cratemod().mods()[0].items[0].name(), ~"b");
91-
assert_eq!(doc.cratemod().mods()[1].items[0].name(), ~"d");
92+
assert_eq!(doc.cratemod().mods()[1].items[0].name(), ~"b");
93+
assert_eq!(doc.cratemod().mods()[2].items[0].name(), ~"d");
9294
}
9395
}

src/librustdoc/trim_pass.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ mod test {
2828
use attr_pass;
2929
use doc;
3030
use extract;
31+
use prune_hidden_pass;
3132
use trim_pass::mk_pass;
3233

3334
fn mk_doc(source: ~str) -> doc::Doc {
3435
do astsrv::from_str(copy source) |srv| {
3536
let doc = extract::from_srv(srv.clone(), ~"");
3637
let doc = (attr_pass::mk_pass().f)(srv.clone(), doc);
38+
let doc = (prune_hidden_pass::mk_pass().f)(srv.clone(), doc);
3739
(mk_pass().f)(srv.clone(), doc)
3840
}
3941
}

src/libsyntax/ext/expand.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,9 @@ pub fn new_span(cx: @ExtCtxt, sp: span) -> span {
453453

454454
pub fn std_macros() -> @str {
455455
return
456-
@"pub mod __std_macros {
456+
@"mod __std_macros {
457457
#[macro_escape];
458+
#[doc(hidden)];
458459

459460
macro_rules! ignore (($($x:tt)*) => (()))
460461

src/test/auxiliary/extern-crosscrate-source.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub mod rustrt {
2626

2727
pub fn fact(n: uint) -> uint {
2828
unsafe {
29-
debug!("n = %?", n);
29+
info!("n = %?", n);
3030
rustrt::rust_dbg_call(cb, n)
3131
}
3232
}

src/test/bench/core-uint-to-str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ fn main() {
2525

2626
for uint::range(0u, n) |i| {
2727
let x = uint::to_str(i);
28-
debug!(x);
28+
info!(x);
2929
}
3030
}

src/test/bench/msgsend-pipes-shared.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,6 @@ fn main() {
110110
copy args
111111
};
112112

113-
debug!("%?", args);
113+
info!("%?", args);
114114
run(args);
115115
}

src/test/bench/msgsend-pipes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,6 @@ fn main() {
106106
copy args
107107
};
108108

109-
debug!("%?", args);
109+
info!("%?", args);
110110
run(args);
111111
}

src/test/bench/shootout-threadring.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fn roundtrip(id: int, n_tasks: int, p: &Port<int>, ch: &Chan<int>) {
4444
return;
4545
}
4646
token => {
47-
debug!("thread: %d got token: %d", id, token);
47+
info!("thread: %d got token: %d", id, token);
4848
ch.send(token - 1);
4949
if token <= n_tasks {
5050
return;

src/test/bench/task-perf-alloc-unwind.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ fn main() {
3333

3434
fn run(repeat: int, depth: int) {
3535
for (repeat as uint).times {
36-
debug!("starting %.4f", precise_time_s());
36+
info!("starting %.4f", precise_time_s());
3737
do task::try {
3838
recurse_or_fail(depth, None)
3939
};
40-
debug!("stopping %.4f", precise_time_s());
40+
info!("stopping %.4f", precise_time_s());
4141
}
4242
}
4343

@@ -71,7 +71,7 @@ fn r(l: @nillist) -> r {
7171

7272
fn recurse_or_fail(depth: int, st: Option<State>) {
7373
if depth == 0 {
74-
debug!("unwinding %.4f", precise_time_s());
74+
info!("unwinding %.4f", precise_time_s());
7575
fail!();
7676
} else {
7777
let depth = depth - 1;

src/test/compile-fail/assign-imm-local-twice.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
fn test() {
1212
let v: int;
1313
v = 1; //~ NOTE prior assignment occurs here
14-
debug!("v=%d", v);
14+
info!("v=%d", v);
1515
v = 2; //~ ERROR re-assignment of immutable variable
16-
debug!("v=%d", v);
16+
info!("v=%d", v);
1717
}
1818

1919
fn main() {

src/test/compile-fail/assign-to-method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ fn cat(in_x : uint, in_y : int) -> cat {
2727

2828
fn main() {
2929
let nyan : cat = cat(52u, 99);
30-
nyan.speak = || debug!("meow"); //~ ERROR attempted to take value of method
30+
nyan.speak = || info!("meow"); //~ ERROR attempted to take value of method
3131
}

src/test/compile-fail/attr-before-ext.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010

1111
fn main() {
1212
#[attr] //~ ERROR expected item after attributes
13-
debug!("hi");
13+
info!("hi");
1414
}

src/test/compile-fail/autoderef-full-lval.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ fn main() {
2121
let a: clam = clam{x: @1, y: @2};
2222
let b: clam = clam{x: @10, y: @20};
2323
let z: int = a.x + b.y; //~ ERROR binary operation + cannot be applied to type `@int`
24-
debug!(z);
24+
info!(z);
2525
assert_eq!(z, 21);
2626
let forty: fish = fish{a: @40};
2727
let two: fish = fish{a: @2};
2828
let answer: int = forty.a + two.a; //~ ERROR binary operation + cannot be applied to type `@int`
29-
debug!(answer);
29+
info!(answer);
3030
assert_eq!(answer, 42);
3131
}

src/test/compile-fail/bad-const-type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
// error-pattern:expected `~str` but found `int`
1212

1313
static i: ~str = 10i;
14-
fn main() { debug!(i); }
14+
fn main() { info!(i); }

src/test/compile-fail/block-arg-as-stmt-with-value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ fn compute1() -> float {
1717

1818
fn main() {
1919
let x = compute1();
20-
debug!(x);
20+
info!(x);
2121
assert_eq!(x, -4f);
2222
}

0 commit comments

Comments
 (0)