Add test for --display-doctest-warnings option

This commit is contained in:
Guillaume Gomez 2021-09-09 16:52:48 +02:00
parent 3a8fcff9b6
commit b531a7f585
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,9 @@
// check-pass
// compile-flags:-Zunstable-options --display-doctest-warnings --test
// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
/// ```
/// let x = 12;
/// ```
pub fn foo() {}

View File

@ -0,0 +1,24 @@
running 1 test
test $DIR/display-output.rs - foo (line 6) ... ok
successes:
---- $DIR/display-output.rs - foo (line 6) stdout ----
warning: unused variable: `x`
--> $DIR/display-output.rs:7:5
|
LL | let x = 12;
| ^ help: if this is intentional, prefix it with an underscore: `_x`
|
= note: `#[warn(unused_variables)]` on by default
warning: 1 warning emitted
successes:
$DIR/display-output.rs - foo (line 6)
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME