From 52d82d54a3736a6298e2f0cb4b9ed186020f6a83 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 25 Oct 2022 23:44:05 +0200 Subject: [PATCH] Revert "hashsum: test b3sum::test_nonames for real (#4027)" This reverts commit 02f6fa7b249f44d4fa5b10c5f008fadaaa9d6f56. --- src/uu/hashsum/src/hashsum.rs | 9 +++++---- tests/by-util/test_hashsum.rs | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/uu/hashsum/src/hashsum.rs b/src/uu/hashsum/src/hashsum.rs index 2d01c9d64..828436595 100644 --- a/src/uu/hashsum/src/hashsum.rs +++ b/src/uu/hashsum/src/hashsum.rs @@ -276,10 +276,11 @@ pub fn uumain(mut args: impl uucore::Args) -> UResult<()> { }; let check = matches.get_flag("check"); let tag = matches.get_flag("tag"); - let nonames = *matches - .try_get_one("no-names") - .unwrap_or(Some(&false)) - .unwrap(); + let nonames = if binary_name == "b3sum" { + matches.get_flag("no-names") + } else { + false + }; let status = matches.get_flag("status"); let quiet = matches.get_flag("quiet") || status; let strict = matches.get_flag("strict"); diff --git a/tests/by-util/test_hashsum.rs b/tests/by-util/test_hashsum.rs index e8f716815..f30eb42ce 100644 --- a/tests/by-util/test_hashsum.rs +++ b/tests/by-util/test_hashsum.rs @@ -34,7 +34,7 @@ macro_rules! test_digest { fn test_nonames() { let ts = TestScenario::new("hashsum"); // EXPECTED_FILE has no newline character at the end - if DIGEST_ARG == "--b3sum" { + if DIGEST_ARG == "b3sum" { // Option only available on b3sum assert_eq!(format!("{0}\n{0}\n", ts.fixtures.read(EXPECTED_FILE)), ts.ucmd().arg(DIGEST_ARG).arg(BITS_ARG).arg("--no-names").arg("input.txt").arg("-").pipe_in_fixture("input.txt")