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

hashsum: change debug to display format with --tag

This commit is contained in:
Terts Diepraam 2023-08-28 23:34:16 +02:00
parent bd82d678ef
commit 93a54f36f3
2 changed files with 17 additions and 1 deletions

View file

@ -744,7 +744,7 @@ where
)
.map_err_context(|| "failed to read input".to_string())?;
if options.tag {
println!("{} ({:?}) = {}", options.algoname, filename.display(), sum);
println!("{} ({}) = {}", options.algoname, filename.display(), sum);
} else if options.nonames {
println!("{sum}");
} else if options.zero {

View file

@ -355,3 +355,19 @@ fn test_check_md5sum_mixed_format() {
fn test_invalid_arg() {
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
}
#[test]
fn test_tag() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
at.write("foobar", "foo bar\n");
scene
.ccmd("sha256sum")
.arg("--tag")
.arg("foobar")
.succeeds()
.stdout_is(
"SHA256 (foobar) = 1f2ec52b774368781bed1d1fb140a92e0eb6348090619c9291f9a5a3c8e8d151\n",
);
}