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

Merge pull request #4854 from cakebaker/cksum_split_test_function

cksum: split test function into two
This commit is contained in:
Sylvestre Ledru 2023-05-10 11:14:26 +02:00 committed by GitHub
commit af58532d8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -33,7 +33,7 @@ fn test_stdin() {
} }
#[test] #[test]
fn test_empty() { fn test_empty_file() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
at.touch("a"); at.touch("a");
@ -62,25 +62,26 @@ fn test_arg_overrides_stdin() {
} }
#[test] #[test]
fn test_invalid_file() { fn test_nonexisting_file() {
let ts = TestScenario::new(util_name!()); let file_name = "asdf";
let at = ts.fixtures.clone();
let folder_name = "asdf"; new_ucmd!()
.arg(file_name)
// First check when file doesn't exist
ts.ucmd()
.arg(folder_name)
.fails() .fails()
.no_stdout() .no_stdout()
.stderr_contains("cksum: asdf: No such file or directory"); .stderr_contains(format!("cksum: {file_name}: No such file or directory"));
}
// Then check when the file is of an invalid type #[test]
fn test_folder() {
let (at, mut ucmd) = at_and_ucmd!();
let folder_name = "a_folder";
at.mkdir(folder_name); at.mkdir(folder_name);
ts.ucmd()
.arg(folder_name) ucmd.arg(folder_name)
.succeeds() .succeeds()
.stdout_only("4294967295 0 asdf\n"); .stdout_only(format!("4294967295 0 {folder_name}\n"));
} }
// Make sure crc is correct for files larger than 32 bytes // Make sure crc is correct for files larger than 32 bytes