Skip to content

Commit d5e3294

Browse files
Add invalid rust code for test
1 parent 6461cde commit d5e3294

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

src/test/rustdoc-ui/nocapture-fail.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// check-pass
2+
// compile-flags:--test -Zunstable-options --nocapture
3+
// normalize-stderr-test: "src/test/rustdoc-ui" -> "$$DIR"
4+
// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
5+
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
6+
7+
/// ```compile_fail
8+
/// fn foo() {
9+
/// Input: 123
10+
/// }
11+
/// ```
12+
pub struct Foo;
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error: struct literal body without path
2+
--> $DIR/nocapture-fail.rs:8:10
3+
|
4+
LL | fn foo() {
5+
| __________^
6+
LL | | Input: 123
7+
LL | | }
8+
| |_^
9+
|
10+
help: you might have forgotten to add the struct literal inside the block
11+
|
12+
LL | fn foo() { SomeStruct {
13+
LL | Input: 123
14+
LL | } }
15+
|
16+
17+
error: aborting due to previous error
18+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
running 1 test
3+
test $DIR/nocapture-fail.rs - Foo (line 7) - compile fail ... ok
4+
5+
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
6+

0 commit comments

Comments
 (0)