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

du: test existing correct behavior: warn about --inodes -b conflict

This commit is contained in:
Ben Wiederhake 2025-04-16 05:11:57 +02:00
parent 0f061dee68
commit d6e78d738d

View file

@ -1264,3 +1264,32 @@ fn test_du_blocksize_zero_do_not_panic() {
)); ));
} }
} }
#[test]
fn test_du_inodes_blocksize_ineffective() {
let ts = TestScenario::new(util_name!());
let at = &ts.fixtures;
let fpath = at.plus("test.txt");
at.touch(fpath);
for method in ["-B3", "--block-size=3"] {
// No warning
ts.ucmd()
.arg(method)
.arg("--inodes")
.arg("test.txt")
.succeeds()
.stdout_only("1\ttest.txt\n");
}
for method in ["--apparent-size", "-b"] {
// A warning appears!
ts.ucmd()
.arg(method)
.arg("--inodes")
.arg("test.txt")
.succeeds()
.stdout_is("1\ttest.txt\n")
.stderr_is(
"du: warning: options --apparent-size and -b are ineffective with --inodes\n",
);
}
}