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

ls: make --block-size and --human-readable/--si

override each other
This commit is contained in:
Daniel Hofstetter 2023-12-11 16:38:55 +01:00
parent 181cfc885b
commit 6711dd5694
2 changed files with 54 additions and 2 deletions

View file

@ -3874,6 +3874,56 @@ fn test_ls_invalid_block_size() {
.stderr_is("ls: invalid --block-size argument 'invalid'\n");
}
#[cfg(all(unix, feature = "dd"))]
#[test]
fn test_ls_block_size_override() {
let scene = TestScenario::new(util_name!());
scene
.ccmd("dd")
.arg("if=/dev/zero")
.arg("of=file")
.arg("bs=1024")
.arg("count=1")
.succeeds();
// --si "wins"
scene
.ucmd()
.arg("-s")
.arg("--block-size=512")
.arg("--si")
.succeeds()
.stdout_contains_line("total 4.1k");
// --block-size "wins"
scene
.ucmd()
.arg("-s")
.arg("--si")
.arg("--block-size=512")
.succeeds()
.stdout_contains_line("total 8");
// --human-readable "wins"
scene
.ucmd()
.arg("-s")
.arg("--block-size=512")
.arg("--human-readable")
.succeeds()
.stdout_contains_line("total 4.0K");
// --block-size "wins"
scene
.ucmd()
.arg("-s")
.arg("--human-readable")
.arg("--block-size=512")
.succeeds()
.stdout_contains_line("total 8");
}
#[test]
fn test_ls_hyperlink() {
let scene = TestScenario::new(util_name!());