1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

Merge pull request #5219 from tertsdiepraam/sum-tag-no-quotes

`hashsum`: change debug to display format with --tag
This commit is contained in:
Daniel Hofstetter 2023-08-29 11:05:57 +02:00 committed by GitHub
commit 9c482e5032
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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",
);
}