coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

Test `test_hashsum::b3sum::test_nonames` for real

Open sylvestre opened this issue 3 years ago • 0 comments

Improved in https://github.com/uutils/coreutils/pull/3816 but not enough as it isn't testing it. This patch runs it:

diff --git a/tests/by-util/test_hashsum.rs b/tests/by-util/test_hashsum.rs
index 06d039d59..7a87125c8 100644
--- a/tests/by-util/test_hashsum.rs
+++ b/tests/by-util/test_hashsum.rs
@@ -34,7 +34,7 @@ macro_rules! test_digest {
         fn test_nonames() {
             let ts = TestScenario::new("hashsum");
             // EXPECTED_FILE has no newline character at the end
-            if DIGEST_ARG == "b3sum" {
+            if DIGEST_ARG == "--b3sum" {
                 // Option only available on b3sum
                 assert_eq!(format!("{0}\n{0}\n", ts.fixtures.read(EXPECTED_FILE)),
                        ts.ucmd().arg(DIGEST_ARG).arg(BITS_ARG).arg("--no-names").arg("input.txt").arg("-").pipe_in_fixture("input.txt")

But fails with:


---- test_hashsum::b3sum::test_nonames stdout ----
current_directory_resolved: 
open: /tmp/.tmpc8CYCJ/b3sum.expected
open: /tmp/.tmpc8CYCJ/input.txt
run: /home/sylvestre/dev/debian/coreutils/target/debug/coreutils hashsum --b3sum --bits=256 --no-names input.txt -
thread 'test_hashsum::b3sum::test_nonames' panicked at 'assertion failed: `(left == right)`
  left: `"a1a55887535397bf461902491c8779188a5dd1f8c3951b3d9cf6ecba194e87b0\na1a55887535397bf461902491c8779188a5dd1f8c3951b3d9cf6ecba194e87b0\n"`,
 right: `"a1a55887535397bf461902491c8779188a5dd1f8c3951b3d9cf6ecba194e87b0  input.txt\na1a55887535397bf461902491c8779188a5dd1f8c3951b3d9cf6ecba194e87b0  -\n"`', /home/sylvestre/dev/debian/coreutils/tests/by-util/test_hashsum.rs:83:1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

To run it:

cargo test test_hashsum::b3sum::test_nonames      

sylvestre avatar Aug 15 '22 08:08 sylvestre