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:
parent
181cfc885b
commit
6711dd5694
2 changed files with 54 additions and 2 deletions
|
@ -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!());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue