Skip to content

Commit e5f1b9f

Browse files
committed
auto merge of #13272 : ipetkov/rust/rustdoc-ignored-tests, r=alexcrichton
librustdoc: instead of skipping ignored tests, pass them to libtest so it can report them as such. If a test is marked as `notrust`, however, it will not show up in the final report. Fix #12939
2 parents 2b27a5a + a0a7693 commit e5f1b9f

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/librustdoc/html/markdown.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -268,24 +268,25 @@ pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector) {
268268
extern fn block(_ob: *buf, text: *buf, lang: *buf, opaque: *libc::c_void) {
269269
unsafe {
270270
if text.is_null() { return }
271-
let (should_fail, no_run, ignore) = if lang.is_null() {
272-
(false, false, false)
271+
let (should_fail, no_run, ignore, notrust) = if lang.is_null() {
272+
(false, false, false, false)
273273
} else {
274274
slice::raw::buf_as_slice((*lang).data,
275275
(*lang).size as uint, |lang| {
276276
let s = str::from_utf8(lang).unwrap();
277277
(s.contains("should_fail"),
278278
s.contains("no_run"),
279-
s.contains("ignore") || s.contains("notrust"))
279+
s.contains("ignore"),
280+
s.contains("notrust"))
280281
})
281282
};
282-
if ignore { return }
283+
if notrust { return }
283284
slice::raw::buf_as_slice((*text).data, (*text).size as uint, |text| {
284285
let tests = &mut *(opaque as *mut ::test::Collector);
285286
let text = str::from_utf8(text).unwrap();
286287
let mut lines = text.lines().map(|l| stripped_filtered_line(l).unwrap_or(l));
287288
let text = lines.collect::<~[&str]>().connect("\n");
288-
tests.add_test(text, should_fail, no_run);
289+
tests.add_test(text, should_fail, no_run, ignore);
289290
})
290291
}
291292
}

src/librustdoc/test.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -221,7 +221,7 @@ impl Collector {
221221
}
222222
}
223223

224-
pub fn add_test(&mut self, test: ~str, should_fail: bool, no_run: bool) {
224+
pub fn add_test(&mut self, test: ~str, should_fail: bool, no_run: bool, should_ignore: bool) {
225225
let name = if self.use_headers {
226226
let s = self.current_header.as_ref().map(|s| s.as_slice()).unwrap_or("");
227227
format!("{}_{}", s, self.cnt)
@@ -236,7 +236,7 @@ impl Collector {
236236
self.tests.push(testing::TestDescAndFn {
237237
desc: testing::TestDesc {
238238
name: testing::DynTestName(name),
239-
ignore: false,
239+
ignore: should_ignore,
240240
should_fail: false, // compiler failures are test failures
241241
},
242242
testfn: testing::DynTestFn(proc() {

0 commit comments

Comments
 (0)