Writing tests
This commit is contained in:
parent
b85d588199
commit
053a696ade
20
src/test/ui/parser/issue-70583-block-is-empty-1.rs
Normal file
20
src/test/ui/parser/issue-70583-block-is-empty-1.rs
Normal file
@ -0,0 +1,20 @@
|
||||
pub enum ErrorHandled {
|
||||
Reported,
|
||||
TooGeneric,
|
||||
}
|
||||
|
||||
impl ErrorHandled {
|
||||
pub fn assert_reported(self) {
|
||||
match self {
|
||||
ErrorHandled::Reported => {}
|
||||
ErrorHandled::TooGeneric => panic!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn struct_generic(x: Vec<i32>) {
|
||||
for v in x {
|
||||
println!("{}", v);
|
||||
}
|
||||
}
|
||||
} //~ ERROR unexpected closing delimiter: `}`
|
8
src/test/ui/parser/issue-70583-block-is-empty-1.stderr
Normal file
8
src/test/ui/parser/issue-70583-block-is-empty-1.stderr
Normal file
@ -0,0 +1,8 @@
|
||||
error: unexpected closing delimiter: `}`
|
||||
--> $DIR/issue-70583-block-is-empty-1.rs:20:1
|
||||
|
|
||||
LL | }
|
||||
| ^ unexpected closing delimiter
|
||||
|
||||
error: aborting due to previous error
|
||||
|
14
src/test/ui/parser/issue-70583-block-is-empty-2.rs
Normal file
14
src/test/ui/parser/issue-70583-block-is-empty-2.rs
Normal file
@ -0,0 +1,14 @@
|
||||
pub enum ErrorHandled {
|
||||
Reported,
|
||||
TooGeneric,
|
||||
}
|
||||
|
||||
impl ErrorHandled {
|
||||
pub fn assert_reported(self) {
|
||||
match self {
|
||||
ErrorHandled::Reported => {}}
|
||||
//^~ ERROR this block is empty, you might have not mean to close it
|
||||
ErrorHandled::TooGeneric => panic!(),
|
||||
}
|
||||
}
|
||||
} //~ ERROR unexpected closing delimiter: `}`
|
11
src/test/ui/parser/issue-70583-block-is-empty-2.stderr
Normal file
11
src/test/ui/parser/issue-70583-block-is-empty-2.stderr
Normal file
@ -0,0 +1,11 @@
|
||||
error: unexpected closing delimiter: `}`
|
||||
--> $DIR/issue-70583-block-is-empty-2.rs:14:1
|
||||
|
|
||||
LL | ErrorHandled::Reported => {}}
|
||||
| -- this block is empty, you might have not meant to close it
|
||||
...
|
||||
LL | }
|
||||
| ^ unexpected closing delimiter
|
||||
|
||||
error: aborting due to previous error
|
||||
|
Loading…
Reference in New Issue
Block a user