Skip to content

Commit 7022a2f

Browse files
Add rustdoc-ui regression test for #140289
1 parent 70c389e commit 7022a2f

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// This test ensures that the output is correctly generated when the
2+
// doctest fails. It checks when there is stderr and stdout, no stdout
3+
// and no stderr/stdout.
4+
//
5+
// This is a regression test for <https://github.com/rust-lang/rust/issues/140289>.
6+
7+
//@ edition: 2024
8+
//@ compile-flags:--test --test-args=--test-threads=1
9+
//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
10+
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
11+
//@ failure-status: 101
12+
13+
//! ```
14+
//! println!("######## from a DOC TEST ########");
15+
//! assert_eq!("doc", "test");
16+
//! ```
17+
//!
18+
//! ```
19+
//! assert_eq!("doc", "test");
20+
//! ```
21+
//!
22+
//! ```
23+
//! std::process::exit(1);
24+
//! ```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
2+
running 3 tests
3+
test $DIR/stdout-and-stderr.rs - (line 12) ... FAILED
4+
test $DIR/stdout-and-stderr.rs - (line 16) ... FAILED
5+
test $DIR/stdout-and-stderr.rs - (line 7) ... FAILED
6+
7+
failures:
8+
9+
---- $DIR/stdout-and-stderr.rs - (line 12) stdout ----
10+
Test executable failed (exit status: 101).
11+
12+
stderr:
13+
14+
thread 'main' panicked at /tmp/rustdoctestSI6fSq/doctest_bundle_2024.rs:6:1:
15+
assertion `left == right` failed
16+
left: "doc"
17+
right: "test"
18+
stack backtrace:
19+
0: __rustc::rust_begin_unwind
20+
1: core::panicking::panic_fmt
21+
2: core::panicking::assert_failed_inner
22+
3: core::panicking::assert_failed
23+
4: doctest_bundle_2024::__doctest_0::main
24+
5: doctest_bundle_2024::__doctest_0::__main_fn
25+
6: doctest_runner_2024::__doctest_0::TEST::{{closure}}
26+
7: core::ops::function::FnOnce::call_once
27+
8: doctest_runner_2024::main
28+
9: core::ops::function::FnOnce::call_once
29+
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
30+
31+
32+
---- $DIR/stdout-and-stderr.rs - (line 16) stdout ----
33+
Test executable failed (exit status: 1).
34+
35+
---- $DIR/stdout-and-stderr.rs - (line 7) stdout ----
36+
Test executable failed (exit status: 101).
37+
38+
stdout:
39+
######## from a DOC TEST ########
40+
41+
stderr:
42+
43+
thread 'main' panicked at /tmp/rustdoctestSI6fSq/doctest_bundle_2024.rs:23:1:
44+
assertion `left == right` failed
45+
left: "doc"
46+
right: "test"
47+
stack backtrace:
48+
0: __rustc::rust_begin_unwind
49+
1: core::panicking::panic_fmt
50+
2: core::panicking::assert_failed_inner
51+
3: core::panicking::assert_failed
52+
4: doctest_bundle_2024::__doctest_2::main
53+
5: doctest_bundle_2024::__doctest_2::__main_fn
54+
6: doctest_runner_2024::__doctest_2::TEST::{{closure}}
55+
7: core::ops::function::FnOnce::call_once
56+
8: doctest_runner_2024::main
57+
9: core::ops::function::FnOnce::call_once
58+
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
59+
60+
61+
62+
failures:
63+
$DIR/stdout-and-stderr.rs - (line 12)
64+
$DIR/stdout-and-stderr.rs - (line 16)
65+
$DIR/stdout-and-stderr.rs - (line 7)
66+
67+
test result: FAILED. 0 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
68+

0 commit comments

Comments
 (0)