Skip to content

Commit 50a3940

Browse files
authored
Merge pull request #7764 from BenWiederhake/dev-du-demo-working-features
du: test existing correct behavior: warn about --inodes -b conflict
2 parents 0f061de + d6e78d7 commit 50a3940

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/by-util/test_du.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,3 +1264,32 @@ fn test_du_blocksize_zero_do_not_panic() {
12641264
));
12651265
}
12661266
}
1267+
1268+
#[test]
1269+
fn test_du_inodes_blocksize_ineffective() {
1270+
let ts = TestScenario::new(util_name!());
1271+
let at = &ts.fixtures;
1272+
let fpath = at.plus("test.txt");
1273+
at.touch(fpath);
1274+
for method in ["-B3", "--block-size=3"] {
1275+
// No warning
1276+
ts.ucmd()
1277+
.arg(method)
1278+
.arg("--inodes")
1279+
.arg("test.txt")
1280+
.succeeds()
1281+
.stdout_only("1\ttest.txt\n");
1282+
}
1283+
for method in ["--apparent-size", "-b"] {
1284+
// A warning appears!
1285+
ts.ucmd()
1286+
.arg(method)
1287+
.arg("--inodes")
1288+
.arg("test.txt")
1289+
.succeeds()
1290+
.stdout_is("1\ttest.txt\n")
1291+
.stderr_is(
1292+
"du: warning: options --apparent-size and -b are ineffective with --inodes\n",
1293+
);
1294+
}
1295+
}

0 commit comments

Comments
 (0)