mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
tests/expr: check prefix operation
This commit is contained in:
parent
17d21d2d9c
commit
44702940d2
1 changed files with 20 additions and 0 deletions
|
@ -100,6 +100,11 @@ fn test_parenthesis() {
|
||||||
.args(&["(", "1", "+", "1", ")", "*", "2"])
|
.args(&["(", "1", "+", "1", ")", "*", "2"])
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_only("4\n");
|
.stdout_only("4\n");
|
||||||
|
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["1", "(", ")"])
|
||||||
|
.fails()
|
||||||
|
.stderr_only("expr: syntax error (operation should be prefix)\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -221,6 +226,11 @@ fn test_index() {
|
||||||
.args(&["index", "αbcdef_f", "f"])
|
.args(&["index", "αbcdef_f", "f"])
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_only("6\n");
|
.stdout_only("6\n");
|
||||||
|
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["αbcdef", "index", "α"])
|
||||||
|
.fails()
|
||||||
|
.stderr_only("expr: syntax error (operation should be prefix)\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -234,6 +244,11 @@ fn test_length() {
|
||||||
.args(&["length", "abcdef"])
|
.args(&["length", "abcdef"])
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_only("6\n");
|
.stdout_only("6\n");
|
||||||
|
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["abcdef", "length"])
|
||||||
|
.fails()
|
||||||
|
.stderr_only("expr: syntax error (operation should be prefix)\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -271,6 +286,11 @@ fn test_substr() {
|
||||||
.args(&["substr", "abc", "1", "1"])
|
.args(&["substr", "abc", "1", "1"])
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_only("a\n");
|
.stdout_only("a\n");
|
||||||
|
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["abc", "substr", "1", "1"])
|
||||||
|
.fails()
|
||||||
|
.stderr_only("expr: syntax error (operation should be prefix)\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue