Skip to content

Commit

Permalink
Merge pull request #5405 from cakebaker/expr_test_invalid_syntaxes
Browse files Browse the repository at this point in the history
expr: test some invalid syntaxes
  • Loading branch information
sylvestre authored Oct 14, 2023
2 parents 62eb5a4 + f6880bf commit c6b1473
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/by-util/test_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,3 +275,16 @@ fn test_invalid_substr() {
.code_is(1)
.stdout_only("\n");
}

#[test]
fn test_invalid_syntax() {
let invalid_syntaxes = [["12", "12"], ["12", "|"], ["|", "12"]];

for invalid_syntax in invalid_syntaxes {
new_ucmd!()
.args(&invalid_syntax)
.fails()
.code_is(2)
.stderr_contains("syntax error");
}
}

0 comments on commit c6b1473

Please sign in to comment.