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

shred: if the file is empty, don't run passes on it

This commit is contained in:
Sylvestre Ledru 2024-03-16 10:48:19 +01:00
parent 322c2b4df6
commit f410d0967f
2 changed files with 48 additions and 25 deletions

View file

@ -143,3 +143,23 @@ fn test_hex() {
ucmd.arg("--size=0x10").arg(file).succeeds();
}
#[test]
fn test_shred_empty() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
let file_a = "test_shred_remove_a";
at.touch(file_a);
// Shred file_a and verify that, as it is empty, it doesn't have "pass 1/3 (random)"
scene
.ucmd()
.arg("-uv")
.arg(file_a)
.succeeds()
.stdout_does_not_contain("pass 1/3 (random)");
assert!(!at.file_exists(file_a));
}