mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
du: deduplicate the input
Should fix: tests/du/hard-link.sh
This commit is contained in:
parent
79f991dd05
commit
95bd50e09a
2 changed files with 73 additions and 9 deletions
|
@ -1194,3 +1194,61 @@ fn test_human_size() {
|
|||
.succeeds()
|
||||
.stdout_contains(format!("1.0K {dir}"));
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "android"))]
|
||||
#[test]
|
||||
fn test_du_deduplicated_input_args() {
|
||||
let ts = TestScenario::new(util_name!());
|
||||
let at = &ts.fixtures;
|
||||
|
||||
at.mkdir("d");
|
||||
at.mkdir("d/d");
|
||||
at.touch("d/f");
|
||||
at.hard_link("d/f", "d/h");
|
||||
|
||||
let result = ts
|
||||
.ucmd()
|
||||
.arg("--inodes")
|
||||
.arg("d")
|
||||
.arg("d")
|
||||
.arg("d")
|
||||
.succeeds();
|
||||
result.no_stderr();
|
||||
|
||||
let result_seq: Vec<String> = result
|
||||
.stdout_str()
|
||||
.lines()
|
||||
.map(|x| x.parse().unwrap())
|
||||
.collect();
|
||||
#[cfg(windows)]
|
||||
assert_eq!(result_seq, ["1\td\\d", "3\td"]);
|
||||
#[cfg(not(windows))]
|
||||
assert_eq!(result_seq, ["1\td/d", "3\td"]);
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "android"))]
|
||||
#[test]
|
||||
fn test_du_no_deduplicated_input_args() {
|
||||
let ts = TestScenario::new(util_name!());
|
||||
let at = &ts.fixtures;
|
||||
|
||||
at.mkdir("d");
|
||||
at.touch("d/d");
|
||||
|
||||
let result = ts
|
||||
.ucmd()
|
||||
.arg("--inodes")
|
||||
.arg("-l")
|
||||
.arg("d")
|
||||
.arg("d")
|
||||
.arg("d")
|
||||
.succeeds();
|
||||
result.no_stderr();
|
||||
|
||||
let result_seq: Vec<String> = result
|
||||
.stdout_str()
|
||||
.lines()
|
||||
.map(|x| x.parse().unwrap())
|
||||
.collect();
|
||||
assert_eq!(result_seq, ["2\td", "2\td", "2\td"]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue