mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
shred: fix random passes* (#7830)
* shred: fix random passes, update documentation, add test * shred: update tests
This commit is contained in:
parent
151b196f50
commit
b151e039ae
2 changed files with 36 additions and 12 deletions
|
@ -10,6 +10,12 @@ use uutests::new_ucmd;
|
|||
use uutests::util::TestScenario;
|
||||
use uutests::util_name;
|
||||
|
||||
const PATTERNS: [&str; 22] = [
|
||||
"000000", "ffffff", "555555", "aaaaaa", "249249", "492492", "6db6db", "924924", "b6db6d",
|
||||
"db6db6", "111111", "222222", "333333", "444444", "666666", "777777", "888888", "999999",
|
||||
"bbbbbb", "cccccc", "dddddd", "eeeeee",
|
||||
];
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails_with_code(1);
|
||||
|
@ -241,3 +247,18 @@ fn test_shred_verbose_no_padding_10() {
|
|||
.succeeds()
|
||||
.stderr_contains("shred: foo: pass 1/10 (random)...\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_all_patterns_present() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
|
||||
let file = "foo.txt";
|
||||
at.write(file, "bar");
|
||||
|
||||
let result = scene.ucmd().arg("-vn25").arg(file).succeeds();
|
||||
|
||||
for pat in PATTERNS {
|
||||
result.stderr_contains(pat);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue