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

hashsum: implement the ignore-missing option

Tested by gnu/tests/cksum/md5sum.pl
This commit is contained in:
Sylvestre Ledru 2024-04-14 20:05:00 +02:00
parent d56c7bbaee
commit b977d61f67
2 changed files with 44 additions and 2 deletions

View file

@ -129,6 +129,33 @@ fn test_check_sha1() {
.stderr_is("");
}
#[test]
fn test_check_md5_ignore_missing() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
at.write("testf", "foobar\n");
at.write(
"testf.sha1",
"14758f1afd44c09b7992073ccf00b43d testf\n14758f1afd44c09b7992073ccf00b43d testf2\n",
);
scene
.ccmd("md5sum")
.arg("-c")
.arg(at.subdir.join("testf.sha1"))
.fails()
.stdout_contains("testf2: FAILED open or read");
scene
.ccmd("md5sum")
.arg("-c")
.arg("--ignore-missing")
.arg(at.subdir.join("testf.sha1"))
.succeeds()
.stdout_is("testf: OK\n")
.stderr_is("");
}
#[test]
fn test_check_b2sum_length_option_0() {
let scene = TestScenario::new(util_name!());
@ -208,7 +235,7 @@ fn test_check_file_not_found_warning() {
.ccmd("sha1sum")
.arg("-c")
.arg(at.subdir.join("testf.sha1"))
.succeeds()
.fails()
.stdout_is("sha1sum: testf: No such file or directory\ntestf: FAILED open or read\n")
.stderr_is("sha1sum: warning: 1 listed file could not be read\n");
}