add UI test for delimiter errors

This commit is contained in:
yukang 2023-09-21 22:56:17 +08:00
parent 62d9034a0d
commit f7cd892b5a
4 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,9 @@
fn foo() {
match 0 {
_ => {}
}
if foo
}
} //~ ERROR unexpected closing delimiter: `}`
fn main() {}

View File

@ -0,0 +1,16 @@
error: unexpected closing delimiter: `}`
--> $DIR/issue-98601-delimiter-error-1.rs:7:1
|
LL | fn foo() {
| - this delimiter might not be properly closed...
LL | match 0 {
LL | _ => {}
| -- block is empty, you might have not meant to close it
...
LL | }
| - ...as it matches this but it has different indentation
LL | }
| ^ unexpected closing delimiter
error: aborting due to previous error

View File

@ -0,0 +1,5 @@
fn main() {
todo!();
}
fn other(_: i32)) {} //~ ERROR unexpected closing delimiter: `)`

View File

@ -0,0 +1,14 @@
error: unexpected closing delimiter: `)`
--> $DIR/issue-98601-delimiter-error-unexpected-close.rs:5:17
|
LL | fn main() {
| - this opening brace...
LL | todo!();
LL | }
| - ...matches this closing brace
LL |
LL | fn other(_: i32)) {}
| ^ unexpected closing delimiter
error: aborting due to previous error