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

ls: fix exit code for --time-style when used

This commit is contained in:
Ben Wiederhake 2024-04-01 04:41:24 +02:00
parent 4a1bd78f48
commit 714b4ff589
2 changed files with 31 additions and 1 deletions

View file

@ -86,6 +86,31 @@ fn test_invalid_value_returns_2() {
}
}
#[test]
fn test_invalid_value_time_style() {
// This is the only flag which does not raise an error if it is invalid but not actually used:
new_ucmd!()
.arg("--time-style=definitely_invalid_value")
.succeeds()
.no_stderr()
.code_is(0);
// If it is used, error:
new_ucmd!()
.arg("-g")
.arg("--time-style=definitely_invalid_value")
.fails()
.no_stdout()
.code_is(2);
// If it only looks temporarily like it might be used, no error:
new_ucmd!()
.arg("-l")
.arg("--time-style=definitely_invalid_value")
.arg("--format=single-column")
.succeeds()
.no_stderr()
.code_is(0);
}
#[test]
fn test_ls_ls() {
new_ucmd!().succeeds();