1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

basename: test flag implications, document -z correctly

This commit is contained in:
Ben Wiederhake 2024-02-25 19:14:17 +01:00
parent d7a09c042a
commit 9441806a23
2 changed files with 17 additions and 1 deletions

View file

@ -1,7 +1,7 @@
# basename
```
basename NAME [SUFFIX]
basename [-z] NAME [SUFFIX]
basename OPTION... NAME...
```

View file

@ -201,3 +201,19 @@ fn test_simple_format() {
fn test_invalid_arg() {
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
}
#[test]
fn test_zero_does_not_imply_multiple() {
new_ucmd!()
.args(&["-z", "foo.c", "c"])
.succeeds()
.stdout_is("foo.\0");
}
#[test]
fn test_suffix_implies_multiple() {
new_ucmd!()
.args(&["-s", ".c", "foo.c", "o.c"])
.succeeds()
.stdout_is("foo\no\n");
}