mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
du: ignore duplicate names with --files0-from
This commit is contained in:
parent
8df064e1fa
commit
e4fbc31714
2 changed files with 36 additions and 1 deletions
|
@ -1010,6 +1010,21 @@ fn test_du_files0_from() {
|
|||
.stdout_contains("testdir");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_du_files0_from_ignore_duplicate_file_names() {
|
||||
let ts = TestScenario::new(util_name!());
|
||||
let at = &ts.fixtures;
|
||||
let file = "testfile";
|
||||
|
||||
at.touch(file);
|
||||
at.write("filelist", &format!("{file}\0{file}\0"));
|
||||
|
||||
ts.ucmd()
|
||||
.arg("--files0-from=filelist")
|
||||
.succeeds()
|
||||
.stdout_is(format!("0\t{file}\n"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_du_files0_from_with_invalid_zero_length_file_names() {
|
||||
let ts = TestScenario::new(util_name!());
|
||||
|
@ -1046,6 +1061,23 @@ fn test_du_files0_from_stdin() {
|
|||
.stdout_contains("testfile2");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_du_files0_from_stdin_ignore_duplicate_file_names() {
|
||||
let ts = TestScenario::new(util_name!());
|
||||
let at = &ts.fixtures;
|
||||
let file = "testfile";
|
||||
|
||||
at.touch(file);
|
||||
|
||||
let input = format!("{file}\0{file}");
|
||||
|
||||
ts.ucmd()
|
||||
.arg("--files0-from=-")
|
||||
.pipe_in(input)
|
||||
.succeeds()
|
||||
.stdout_is(format!("0\t{file}\n"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_du_files0_from_stdin_with_invalid_zero_length_file_names() {
|
||||
new_ucmd!()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue