From fff2484700bb7d1fa320a666109d1868767dfa6a Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 3 Apr 2025 17:21:03 +0200 Subject: [PATCH] Add regression test for #137970 --- .../edition-2024-doctest-error-output.rs | 12 +++++++ .../edition-2024-doctest-error-output.stdout | 32 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 tests/rustdoc-ui/edition-2024-doctest-error-output.rs create mode 100644 tests/rustdoc-ui/edition-2024-doctest-error-output.stdout diff --git a/tests/rustdoc-ui/edition-2024-doctest-error-output.rs b/tests/rustdoc-ui/edition-2024-doctest-error-output.rs new file mode 100644 index 00000000000..cabe5d1ae6e --- /dev/null +++ b/tests/rustdoc-ui/edition-2024-doctest-error-output.rs @@ -0,0 +1,12 @@ +// This is a regression test for . +// The output must look nice and not like a `Debug` display of a `String`. + +//@ edition: 2024 +//@ compile-flags: --test +//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ failure-status: 101 + +//! ```rust +//! assert_eq!(2 + 2, 5); +//! ``` diff --git a/tests/rustdoc-ui/edition-2024-doctest-error-output.stdout b/tests/rustdoc-ui/edition-2024-doctest-error-output.stdout new file mode 100644 index 00000000000..5c4de44c21a --- /dev/null +++ b/tests/rustdoc-ui/edition-2024-doctest-error-output.stdout @@ -0,0 +1,32 @@ + +running 1 test +test tests/rustdoc-ui/edition-2024-doctest-error-output.rs - (line 10) ... FAILED + +failures: + +---- tests/rustdoc-ui/edition-2024-doctest-error-output.rs - (line 10) stdout ---- + +thread 'main' panicked at /tmp/rustdoctestSZq9aS/doctest_bundle_2024.rs:6:1: +assertion `left == right` failed + left: 4 + right: 5 +stack backtrace: + 0: __rustc::rust_begin_unwind + 1: core::panicking::panic_fmt + 2: core::panicking::assert_failed_inner + 3: core::panicking::assert_failed + 4: doctest_bundle_2024::__doctest_0::main + 5: doctest_bundle_2024::__doctest_0::__main_fn + 6: doctest_runner_2024::__doctest_0::TEST::{{closure}} + 7: core::ops::function::FnOnce::call_once + 8: doctest_runner_2024::main + 9: core::ops::function::FnOnce::call_once +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. + + + +failures: + tests/rustdoc-ui/edition-2024-doctest-error-output.rs - (line 10) + +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME +