Add "while" tests for issue 54109

This commit is contained in:
Vitaly _Vi Shukela 2018-09-13 20:51:29 +03:00
parent acc44e40cc
commit 79919a7ed6
No known key found for this signature in database
GPG Key ID: C097221D6E03DF68
2 changed files with 38 additions and 1 deletions

View File

@ -44,5 +44,23 @@ fn test_or_par() {
}
}
fn test_while_and() {
let a = true;
let b = false;
while a and b {
//~^ ERROR expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `and`
println!("both");
}
}
fn test_while_or() {
let a = true;
let b = false;
while a or b {
//~^ ERROR expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `or`
println!("both");
}
}
fn main() {
}

View File

@ -32,4 +32,23 @@ LL | if (a or b) {
| expected one of 8 possible tokens here
| help: use `||` instead of `or` for the boolean operator: `||`
error: aborting due to 4 previous errors
error: expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `and`
--> $DIR/issue-54109-and_instead_of_ampersands.rs:50:13
|
LL | while a and b {
| ^^^
| |
| expected one of `!`, `.`, `::`, `?`, `{`, or an operator here
| help: use `&&` instead of `and` for the boolean operator: `&&`
error: expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `or`
--> $DIR/issue-54109-and_instead_of_ampersands.rs:59:13
|
LL | while a or b {
| ^^
| |
| expected one of `!`, `.`, `::`, `?`, `{`, or an operator here
| help: use `||` instead of `or` for the boolean operator: `||`
error: aborting due to 6 previous errors