mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
tests/cksum: add tests for the length argument
This commit is contained in:
parent
037073d852
commit
09ef150085
3 changed files with 38 additions and 0 deletions
|
@ -228,3 +228,37 @@ fn test_untagged_algorithm_stdin() {
|
|||
.stdout_is_fixture(format!("untagged/{algo}_stdin.expected"));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_length_with_wrong_algorithm() {
|
||||
new_ucmd!()
|
||||
.arg("--length=16")
|
||||
.arg("--algorithm=md5")
|
||||
.arg("lorem_ipsum.txt")
|
||||
.fails()
|
||||
.no_stdout()
|
||||
.stderr_contains("cksum: --length is only supported with --algorithm=blake2b")
|
||||
.code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_length_not_supported() {
|
||||
new_ucmd!()
|
||||
.arg("--length=15")
|
||||
.arg("lorem_ipsum.txt")
|
||||
.fails()
|
||||
.no_stdout()
|
||||
.stderr_is_fixture("unsupported_length.expected")
|
||||
.code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_length() {
|
||||
new_ucmd!()
|
||||
.arg("--length=16")
|
||||
.arg("--algorithm=blake2b")
|
||||
.arg("lorem_ipsum.txt")
|
||||
.arg("alice_in_wonderland.txt")
|
||||
.succeeds()
|
||||
.stdout_is_fixture("supported_length.expected");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue