From e9cf31451ec482f1f6c93f6424f8a49ce186ff6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dorian=20P=C3=A9ron?= Date: Thu, 24 Oct 2024 00:29:45 +0200 Subject: [PATCH] test(cksum): add tests for -z/--zero --- tests/by-util/test_cksum.rs | 19 ++++++++++++++++++ .../cksum/zero_multiple_file.expected | Bin 0 -> 69 bytes .../fixtures/cksum/zero_single_file.expected | Bin 0 -> 39 bytes 3 files changed, 19 insertions(+) create mode 100644 tests/fixtures/cksum/zero_multiple_file.expected create mode 100644 tests/fixtures/cksum/zero_single_file.expected diff --git a/tests/by-util/test_cksum.rs b/tests/by-util/test_cksum.rs index c408ae34d..07c6e7b17 100644 --- a/tests/by-util/test_cksum.rs +++ b/tests/by-util/test_cksum.rs @@ -1383,3 +1383,22 @@ fn test_check_failed_to_read() { .stdout_is("dir: FAILED open or read\n") .stderr_contains("cksum: WARNING: 1 listed file could not be read"); } + +#[test] +fn test_zero_multiple_file() { + new_ucmd!() + .arg("-z") + .arg("alice_in_wonderland.txt") + .arg("lorem_ipsum.txt") + .succeeds() + .stdout_is_fixture("zero_multiple_file.expected"); +} + +#[test] +fn test_zero_single_file() { + new_ucmd!() + .arg("--zero") + .arg("alice_in_wonderland.txt") + .succeeds() + .stdout_is_fixture("zero_single_file.expected"); +} diff --git a/tests/fixtures/cksum/zero_multiple_file.expected b/tests/fixtures/cksum/zero_multiple_file.expected new file mode 100644 index 0000000000000000000000000000000000000000..46ad77aca49914b91eb0d47bee58fe5b41d84a07 GIT binary patch literal 69 zcmXrEFfg?=FgG_aS1>j(Qb^3nOiqo@%!@D2&r3-y%1O*i(JQGaVK6qgFtRi;HaAl+ VH#btq$uCOHjn6D7F3knY0sy`l6)pe( literal 0 HcmV?d00001 diff --git a/tests/fixtures/cksum/zero_single_file.expected b/tests/fixtures/cksum/zero_single_file.expected new file mode 100644 index 0000000000000000000000000000000000000000..23292d9b58c2abd499f2f6d012b5a07028293d73 GIT binary patch literal 39 ucmXrEFfg?=FgG_aS1>j(Qb^3nOiqo@%!@D2&r3-y%1O*i(JQGaVE_QuP7E^u literal 0 HcmV?d00001