mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
expr: fix substr parsing
This commit is contained in:
parent
83424751c1
commit
6049bc091a
2 changed files with 16 additions and 3 deletions
|
@ -507,6 +507,19 @@ fn test_substr() {
|
|||
.stderr_only("expr: syntax error: unexpected argument 'substr'\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_substr_precedence() {
|
||||
new_ucmd!()
|
||||
.args(&["substr", "ab cd", "3", "1", "!=", " "])
|
||||
.fails_with_code(1)
|
||||
.stdout_only("0\n");
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["substr", "ab cd", "2", "1", "!=", " "])
|
||||
.succeeds()
|
||||
.stdout_only("1\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_substr() {
|
||||
new_ucmd!()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue