Merge pull request #4088 from tertsdiepraam/hashsum-test-no-names

hashsum: enable testing --no-names
This commit is contained in:
Sylvestre Ledru 2022-10-27 19:55:45 +02:00 committed by GitHub
commit 00d93ff451
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View file

@ -276,11 +276,10 @@ pub fn uumain(mut args: impl uucore::Args) -> UResult<()> {
};
let check = matches.get_flag("check");
let tag = matches.get_flag("tag");
let nonames = if binary_name == "b3sum" {
matches.get_flag("no-names")
} else {
false
};
let nonames = *matches
.try_get_one("no-names")
.unwrap_or(None)
.unwrap_or(&false);
let status = matches.get_flag("status");
let quiet = matches.get_flag("quiet") || status;
let strict = matches.get_flag("strict");

View file

@ -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")