Add invalid rust code for test
This commit is contained in:
parent
6461cde51f
commit
d5e3294734
12
src/test/rustdoc-ui/nocapture-fail.rs
Normal file
12
src/test/rustdoc-ui/nocapture-fail.rs
Normal 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;
|
18
src/test/rustdoc-ui/nocapture-fail.stderr
Normal file
18
src/test/rustdoc-ui/nocapture-fail.stderr
Normal 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
|
||||
|
6
src/test/rustdoc-ui/nocapture-fail.stdout
Normal file
6
src/test/rustdoc-ui/nocapture-fail.stdout
Normal 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
|
||||
|
Loading…
Reference in New Issue
Block a user