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

cksum: add binary and prepare the rest

This commit is contained in:
Sylvestre Ledru 2024-04-20 18:55:36 +02:00 committed by Ben Wiederhake
parent dc5342d115
commit 10d8fd6f98
2 changed files with 73 additions and 11 deletions

View file

@ -231,6 +231,16 @@ fn test_untagged_algorithm_single_file() {
}
}
#[test]
fn test_tag_short() {
new_ucmd!()
.arg("-t")
.arg("--algorithm=md5")
.arg("lorem_ipsum.txt")
.succeeds()
.stdout_is("MD5 (lorem_ipsum.txt) = cd724690f7dc61775dfac400a71f2caa\n");
}
#[test]
fn test_untagged_algorithm_after_tag() {
new_ucmd!()
@ -379,15 +389,13 @@ fn test_base64_raw_conflicts() {
#[test]
fn test_base64_single_file() {
for algo in ALGOS {
for base64_option in ["--base64", "-b"] {
new_ucmd!()
.arg(base64_option)
.arg("lorem_ipsum.txt")
.arg(format!("--algorithm={algo}"))
.succeeds()
.no_stderr()
.stdout_is_fixture_bytes(format!("base64/{algo}_single_file.expected"));
}
new_ucmd!()
.arg("--base64")
.arg("lorem_ipsum.txt")
.arg(format!("--algorithm={algo}"))
.succeeds()
.no_stderr()
.stdout_is_fixture_bytes(format!("base64/{algo}_single_file.expected"));
}
}
#[test]
@ -435,6 +443,23 @@ fn test_all_algorithms_fail_on_folder() {
}
}
#[test]
fn test_binary_file() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
at.touch("f");
scene
.ucmd()
.arg("--untagged")
.arg("-b")
.arg("--algorithm=md5")
.arg(at.subdir.join("f"))
.succeeds()
.stdout_contains("d41d8cd98f00b204e9800998ecf8427e *");
}
#[test]
fn test_folder_and_file() {
let scene = TestScenario::new(util_name!());