Skip to content

Commit

Permalink
expr: test some invalid syntaxes
Browse files Browse the repository at this point in the history
  • Loading branch information
cakebaker committed Oct 14, 2023
1 parent 62eb5a4 commit f6880bf
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 f6880bf

Please sign in to comment.