mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
cksum: allow repeated flags and arguments
This commit is contained in:
parent
32b5591736
commit
edb1eb0a76
2 changed files with 27 additions and 0 deletions
|
@ -365,6 +365,7 @@ pub fn uu_app() -> Command {
|
||||||
.about(ABOUT)
|
.about(ABOUT)
|
||||||
.override_usage(format_usage(USAGE))
|
.override_usage(format_usage(USAGE))
|
||||||
.infer_long_args(true)
|
.infer_long_args(true)
|
||||||
|
.args_override_self(true)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(options::FILE)
|
Arg::new(options::FILE)
|
||||||
.hide(true)
|
.hide(true)
|
||||||
|
|
|
@ -128,6 +128,18 @@ fn test_stdin_larger_than_128_bytes() {
|
||||||
assert_eq!(bytes_cnt, 2058);
|
assert_eq!(bytes_cnt, 2058);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_repeated_flags() {
|
||||||
|
new_ucmd!()
|
||||||
|
.arg("-a")
|
||||||
|
.arg("sha1")
|
||||||
|
.arg("--algo=sha256")
|
||||||
|
.arg("-a=md5")
|
||||||
|
.arg("lorem_ipsum.txt")
|
||||||
|
.succeeds()
|
||||||
|
.stdout_is_fixture("md5_single_file.expected");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_algorithm_single_file() {
|
fn test_algorithm_single_file() {
|
||||||
for algo in ALGOS {
|
for algo in ALGOS {
|
||||||
|
@ -291,6 +303,20 @@ fn test_length_is_zero() {
|
||||||
.stdout_is_fixture("length_is_zero.expected");
|
.stdout_is_fixture("length_is_zero.expected");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_length_repeated() {
|
||||||
|
new_ucmd!()
|
||||||
|
.arg("--length=10")
|
||||||
|
.arg("--length=123456")
|
||||||
|
.arg("--length=0")
|
||||||
|
.arg("--algorithm=blake2b")
|
||||||
|
.arg("lorem_ipsum.txt")
|
||||||
|
.arg("alice_in_wonderland.txt")
|
||||||
|
.succeeds()
|
||||||
|
.no_stderr()
|
||||||
|
.stdout_is_fixture("length_is_zero.expected");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_raw_single_file() {
|
fn test_raw_single_file() {
|
||||||
for algo in ALGOS {
|
for algo in ALGOS {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue