mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
du: add -P/--no-dereference
This commit is contained in:
parent
1c7a788093
commit
29f6631554
2 changed files with 45 additions and 7 deletions
|
@ -336,6 +336,42 @@ fn _du_dereference(s: &str) {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
#[test]
|
||||
fn test_du_no_dereference() {
|
||||
let ts = TestScenario::new(util_name!());
|
||||
let at = &ts.fixtures;
|
||||
let dir = "a_dir";
|
||||
let symlink = "symlink";
|
||||
|
||||
at.mkdir(dir);
|
||||
at.symlink_dir(dir, symlink);
|
||||
|
||||
for arg in ["-P", "--no-dereference"] {
|
||||
ts.ucmd()
|
||||
.arg(arg)
|
||||
.succeeds()
|
||||
.stdout_contains(dir)
|
||||
.stdout_does_not_contain(symlink);
|
||||
|
||||
// ensure no-dereference "wins"
|
||||
ts.ucmd()
|
||||
.arg("--dereference")
|
||||
.arg(arg)
|
||||
.succeeds()
|
||||
.stdout_contains(dir)
|
||||
.stdout_does_not_contain(symlink);
|
||||
|
||||
// ensure dereference "wins"
|
||||
ts.ucmd()
|
||||
.arg(arg)
|
||||
.arg("--dereference")
|
||||
.succeeds()
|
||||
.stdout_contains(symlink)
|
||||
.stdout_does_not_contain(dir);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_du_inodes_basic() {
|
||||
let ts = TestScenario::new(util_name!());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue