Writing tests

This commit is contained in:
Kevin Per 2020-04-02 07:17:46 +00:00
parent b85d588199
commit 053a696ade
4 changed files with 53 additions and 0 deletions

View 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: `}`

View 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

View 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: `}`

View 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