Skip to content

Commit

Permalink
Add invalid rust code for test
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jul 18, 2021
1 parent 6461cde commit d5e3294
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/test/rustdoc-ui/nocapture-fail.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 18 additions & 0 deletions src/test/rustdoc-ui/nocapture-fail.stderr
Original file line number Diff line number Diff line change
@@ -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 changes: 6 additions & 0 deletions src/test/rustdoc-ui/nocapture-fail.stdout
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d5e3294

Please sign in to comment.