Skip to content

2024 doctests don't show stdout when failing #140289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
GuillaumeGomez opened this issue Apr 25, 2025 · 1 comment · Fixed by #140291
Closed

2024 doctests don't show stdout when failing #140289

GuillaumeGomez opened this issue Apr 25, 2025 · 1 comment · Fixed by #140291
Assignees
Labels
A-doctests Area: Documentation tests, run by rustdoc C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@GuillaumeGomez
Copy link
Member

Can be seen with:

//! ```
//! println!("######## from a DOC TEST ########");
//! assert_eq!("doc", "test");
//! ```

Before 2024:

running 1 test
test src/lib.rs - (line 1) ... FAILED

failures:

---- src/lib.rs - (line 1) stdout ----
Test executable failed (exit status: 101).

stdout:
######## from a DOC TEST ########

stderr:

thread 'main' panicked at src/lib.rs:4:1:
assertion `left == right` failed
  left: "doc"
 right: "test"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

With 2024:

running 1 test
test src/lib.rs - (line 1) ... FAILED

failures:

---- src/lib.rs - (line 1) stdout ----

thread 'main' panicked at /tmp/rustdoctestMXBeHp/doctest_bundle_2024.rs:7:1:
assertion `left == right` failed
  left: "doc"
 right: "test"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Initially reported here.

cc @slluk

@GuillaumeGomez GuillaumeGomez added A-doctests Area: Documentation tests, run by rustdoc C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Apr 25, 2025
@GuillaumeGomez GuillaumeGomez self-assigned this Apr 25, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 25, 2025
@GuillaumeGomez GuillaumeGomez removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 25, 2025
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Apr 25, 2025
@GuillaumeGomez
Copy link
Member Author

Fixed in #140291.

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Apr 25, 2025
jhpratt added a commit to jhpratt/rust that referenced this issue Apr 26, 2025
…, r=notriddle

Correctly display stdout and stderr in case a doctest is failing

Fixes rust-lang#140289.

Since the doctest is actually running itself, we need to handle the output directly inside it.

cc `@fmease`
r? `@notriddle`
tgross35 added a commit to tgross35/rust that referenced this issue Apr 27, 2025
…, r=notriddle

Correctly display stdout and stderr in case a doctest is failing

Fixes rust-lang#140289.

Since the doctest is actually running itself, we need to handle the output directly inside it.

cc ``@fmease``
r? ``@notriddle``
@bors bors closed this as completed in 8947e16 Apr 27, 2025
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this issue Apr 28, 2025
Correctly display stdout and stderr in case a doctest is failing

Fixes rust-lang/rust#140289.

Since the doctest is actually running itself, we need to handle the output directly inside it.

cc `@fmease`
r? `@notriddle`
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Apr 29, 2025
Correctly display stdout and stderr in case a doctest is failing

Fixes rust-lang/rust#140289.

Since the doctest is actually running itself, we need to handle the output directly inside it.

cc `@fmease`
r? `@notriddle`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-doctests Area: Documentation tests, run by rustdoc C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
Development

Successfully merging a pull request may close this issue.

2 participants