Add/update rustdoc-ui tests to check new merged doctests

This commit is contained in:
Guillaume Gomez 2024-06-10 22:58:24 +02:00
parent 7ec3cabe17
commit 2fd8d1c1ce
8 changed files with 42 additions and 9 deletions

View File

@ -0,0 +1,12 @@
// 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
//@ compile-flags:--test --edition 2021
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ failure-status: 101
/// ```should_panic
/// println!("Hello, world!");
/// ```
pub struct Foo;

View File

@ -0,0 +1,14 @@
running 1 test
test $DIR/failed-doctest-should-panic-2021.rs - Foo (line 9) ... FAILED
failures:
---- $DIR/failed-doctest-should-panic-2021.rs - Foo (line 9) stdout ----
Test executable succeeded, but it's marked `should_panic`.
failures:
$DIR/failed-doctest-should-panic-2021.rs - Foo (line 9)
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME

View File

@ -1,7 +1,7 @@
// FIXME: if/when the output of the test harness can be tested on its own, this test should be // 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 // adapted to use that, and that normalize line can go away
//@ compile-flags:--test //@ compile-flags:--test -Z unstable-options --edition 2024
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME" //@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ failure-status: 101 //@ failure-status: 101

View File

@ -1,11 +1,12 @@
running 1 test running 1 test
test $DIR/failed-doctest-should-panic.rs - Foo (line 9) ... FAILED test $DIR/failed-doctest-should-panic.rs - Foo (line 9) - should panic ... FAILED
failures: failures:
---- $DIR/failed-doctest-should-panic.rs - Foo (line 9) stdout ---- ---- $DIR/failed-doctest-should-panic.rs - Foo (line 9) stdout ----
Test executable succeeded, but it's marked `should_panic`. Hello, world!
note: test did not panic as expected
failures: failures:
$DIR/failed-doctest-should-panic.rs - Foo (line 9) $DIR/failed-doctest-should-panic.rs - Foo (line 9)

View File

@ -1,7 +1,7 @@
//@ compile-flags:--test --test-args=--test-threads=1 -Zunstable-options --edition 2024 //@ compile-flags:--test --test-args=--test-threads=1 -Zunstable-options --edition 2024
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" //@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ normalize-stdout-test "wrong-ast.rs:\d+:\d+" -> "wrong-ast.rs:$$LINE:$$COL" //@ normalize-stdout-test ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL"
//@ failure-status: 101 //@ failure-status: 101
/// ``` /// ```

View File

@ -1,4 +1,10 @@
running 1 test
test $DIR/wrong-ast-2024.rs - three (line 17) - should panic ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
running 2 tests running 2 tests
test $DIR/wrong-ast-2024.rs - one (line 7) ... FAILED test $DIR/wrong-ast-2024.rs - one (line 7) ... FAILED
test $DIR/wrong-ast-2024.rs - two (line 12) ... FAILED test $DIR/wrong-ast-2024.rs - two (line 12) ... FAILED
@ -7,10 +13,10 @@ failures:
---- $DIR/wrong-ast-2024.rs - one (line 7) stdout ---- ---- $DIR/wrong-ast-2024.rs - one (line 7) stdout ----
error[E0758]: unterminated block comment error[E0758]: unterminated block comment
--> $DIR/wrong-ast-2024.rs:8:1 --> $DIR/wrong-ast-2024.rs:$LINE:$COL
| |
LL | /* plop LL | /* plop
| ^^^^^^^^ | ^^^^^^^
error: aborting due to 1 previous error error: aborting due to 1 previous error
@ -18,7 +24,7 @@ For more information about this error, try `rustc --explain E0758`.
Couldn't compile the test. Couldn't compile the test.
---- $DIR/wrong-ast-2024.rs - two (line 12) stdout ---- ---- $DIR/wrong-ast-2024.rs - two (line 12) stdout ----
error: unexpected closing delimiter: `}` error: unexpected closing delimiter: `}`
--> $DIR/wrong-ast-2024.rs:13:1 --> $DIR/wrong-ast-2024.rs:$LINE:$COL
| |
LL | } mod __doctest_1 { fn main() { LL | } mod __doctest_1 { fn main() {
| ^ unexpected closing delimiter | ^ unexpected closing delimiter

View File

@ -1,7 +1,7 @@
//@ compile-flags:--test --test-args=--test-threads=1 //@ compile-flags:--test --test-args=--test-threads=1
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" //@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ normalize-stdout-test "wrong-ast.rs:\d+:\d+" -> "wrong-ast.rs:$$LINE:$$COL" //@ normalize-stdout-test ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL"
//@ failure-status: 101 //@ failure-status: 101
/// ``` /// ```

View File

@ -11,7 +11,7 @@ error[E0758]: unterminated block comment
--> $DIR/wrong-ast.rs:$LINE:$COL --> $DIR/wrong-ast.rs:$LINE:$COL
| |
LL | /* plop LL | /* plop
| ^^^^^^^^ | ^^^^^^^
error: aborting due to 1 previous error error: aborting due to 1 previous error