mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
test/expr: add 'index' operator tests
This commit is contained in:
parent
f3285d9662
commit
8e7dbb0bf6
1 changed files with 25 additions and 0 deletions
|
@ -97,6 +97,31 @@ fn test_and() {
|
|||
new_ucmd!().args(&["", "&", "1"]).run().stdout_is("0\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_index() {
|
||||
new_ucmd!()
|
||||
.args(&["index", "αbcdef", "x"])
|
||||
.fails()
|
||||
.status_code(1)
|
||||
.stdout_only("0\n");
|
||||
new_ucmd!()
|
||||
.args(&["index", "αbcdef", "α"])
|
||||
.succeeds()
|
||||
.stdout_only("1\n");
|
||||
new_ucmd!()
|
||||
.args(&["index", "αbcdef", "fb"])
|
||||
.succeeds()
|
||||
.stdout_only("2\n");
|
||||
new_ucmd!()
|
||||
.args(&["index", "αbcdef", "f"])
|
||||
.succeeds()
|
||||
.stdout_only("6\n");
|
||||
new_ucmd!()
|
||||
.args(&["index", "αbcdef_f", "f"])
|
||||
.succeeds()
|
||||
.stdout_only("6\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_length_fail() {
|
||||
new_ucmd!().args(&["length", "αbcdef", "1"]).fails();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue