1
Fork 0

doctests: build test bundle and harness separately

This prevents the included test case from getting at nightly-only
features when run on stable. The harness builds with
RUSTC_BOOTSTRAP, but the bundle doesn't.
This commit is contained in:
Michael Howell 2025-03-02 19:37:40 -07:00 committed by León Orell Valerian Liehr
parent 5d6eeea5f9
commit 9cf531d26f
No known key found for this signature in database
GPG key ID: D17A07215F68E713
7 changed files with 255 additions and 98 deletions

View file

@ -2,7 +2,7 @@
//@[edition2015]edition:2015
//@[edition2015]aux-build:extern_macros.rs
//@[edition2015]compile-flags:--test --test-args=--test-threads=1
//@[edition2024]edition:2015
//@[edition2024]edition:2024
//@[edition2024]aux-build:extern_macros.rs
//@[edition2024]compile-flags:--test --test-args=--test-threads=1
//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"

View file

@ -0,0 +1,28 @@
running 1 test
test $DIR/failed-doctest-test-crate.rs - m (line 14) ... FAILED
failures:
---- $DIR/failed-doctest-test-crate.rs - m (line 14) stdout ----
error[E0432]: unresolved import `test`
--> $DIR/failed-doctest-test-crate.rs:15:5
|
LL | use test::*;
| ^^^^ use of unresolved module or unlinked crate `test`
|
help: you might be missing a crate named `test`, add it to your project and import it in your code
|
LL + extern crate test;
|
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0432`.
Couldn't compile the test.
failures:
$DIR/failed-doctest-test-crate.rs - m (line 14)
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME

View file

@ -0,0 +1,25 @@
running 1 test
test $DIR/failed-doctest-test-crate.rs - m (line 14) ... FAILED
failures:
---- $DIR/failed-doctest-test-crate.rs - m (line 14) stdout ----
error[E0432]: unresolved import `test`
--> $DIR/failed-doctest-test-crate.rs:15:5
|
LL | use test::*;
| ^^^^ use of unresolved module or unlinked crate `test`
|
= help: you might be missing a crate named `test`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0432`.
Couldn't compile the test.
failures:
$DIR/failed-doctest-test-crate.rs - m (line 14)
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME

View file

@ -0,0 +1,17 @@
// FIXME: if/when the output of the test harness can be tested on its own, this test should be
// adapted to use that, and that normalize line can go away
//@ revisions: edition2015 edition2024
//@[edition2015]edition:2015
//@[edition2024]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
/// <https://github.com/rust-lang/rust/pull/137899#discussion_r1976743383>
///
/// ```rust
/// use test::*;
/// ```
pub mod m {}