mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Merge branch 'main' into cksum
This commit is contained in:
commit
d72343bc64
2 changed files with 21 additions and 0 deletions
|
@ -207,6 +207,13 @@ where
|
|||
(ALGORITHM_OPTIONS_CRC, true) => println!("{sum} {sz}"),
|
||||
(ALGORITHM_OPTIONS_CRC, false) => println!("{sum} {sz} {}", filename.display()),
|
||||
(ALGORITHM_OPTIONS_BLAKE2B, _) if !options.untagged => {
|
||||
if filename.is_dir() {
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::InvalidInput,
|
||||
format!("{}: Is a directory", filename.display()),
|
||||
)
|
||||
.into());
|
||||
}
|
||||
if let Some(length) = options.length {
|
||||
// Multiply by 8 here, as we want to print the length in bits.
|
||||
println!("BLAKE2b-{} ({}) = {sum}", length * 8, filename.display());
|
||||
|
|
|
@ -308,3 +308,17 @@ fn test_raw_multiple_files() {
|
|||
.stderr_contains("cksum: the --raw option is not supported with multiple files")
|
||||
.code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_blake2b_fail_on_directory() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
||||
let folder_name = "a_folder";
|
||||
at.mkdir(folder_name);
|
||||
|
||||
ucmd.arg("--algorithm=blake2b")
|
||||
.arg(folder_name)
|
||||
.fails()
|
||||
.no_stdout()
|
||||
.stderr_contains(format!("cksum: {folder_name}: Is a directory"));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue