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:
parent
5d6eeea5f9
commit
9cf531d26f
7 changed files with 255 additions and 98 deletions
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
17
tests/rustdoc-ui/doctest/failed-doctest-test-crate.rs
Normal file
17
tests/rustdoc-ui/doctest/failed-doctest-test-crate.rs
Normal 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 {}
|
Loading…
Add table
Add a link
Reference in a new issue