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

hashsum: allow multiple usage of -l and take the last one

tested by gnu/tests/cksum/b2sum.sh
This commit is contained in:
Sylvestre Ledru 2024-04-20 15:14:11 +02:00 committed by Ben Wiederhake
parent b64183b0de
commit dc5342d115
2 changed files with 18 additions and 1 deletions

View file

@ -481,7 +481,8 @@ fn uu_app_opt_length(command: Command) -> Command {
.long("length") .long("length")
.help("digest length in bits; must not exceed the max for the blake2 algorithm (512) and must be a multiple of 8") .help("digest length in bits; must not exceed the max for the blake2 algorithm (512) and must be a multiple of 8")
.value_name("BITS") .value_name("BITS")
.value_parser(parse_bit_num), .value_parser(parse_bit_num)
.overrides_with("length"),
) )
} }

View file

@ -180,6 +180,22 @@ fn test_check_b2sum_length_option_0() {
.stdout_only("testf: OK\n"); .stdout_only("testf: OK\n");
} }
#[test]
fn test_check_b2sum_length_duplicate() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
at.write("testf", "foobar\n");
scene
.ccmd("b2sum")
.arg("--length=123")
.arg("--length=128")
.arg("testf")
.succeeds()
.stdout_contains("d6d45901dec53e65d2b55fb6e2ab67b0");
}
#[test] #[test]
fn test_check_b2sum_length_option_8() { fn test_check_b2sum_length_option_8() {
let scene = TestScenario::new(util_name!()); let scene = TestScenario::new(util_name!());