Add invalid rust code for test

This commit is contained in:
Guillaume Gomez 2021-07-09 11:06:20 +02:00
parent 6461cde51f
commit d5e3294734
3 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,12 @@
// check-pass
// compile-flags:--test -Zunstable-options --nocapture
// normalize-stderr-test: "src/test/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
/// ```compile_fail
/// fn foo() {
/// Input: 123
/// }
/// ```
pub struct Foo;

View File

@ -0,0 +1,18 @@
error: struct literal body without path
--> $DIR/nocapture-fail.rs:8:10
|
LL | fn foo() {
| __________^
LL | | Input: 123
LL | | }
| |_^
|
help: you might have forgotten to add the struct literal inside the block
|
LL | fn foo() { SomeStruct {
LL | Input: 123
LL | } }
|
error: aborting due to previous error

View File

@ -0,0 +1,6 @@
running 1 test
test $DIR/nocapture-fail.rs - Foo (line 7) - compile fail ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME