From e50eb19056160cdb6df38ce579ca9b8f29491d0b Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Tue, 20 Feb 2024 03:47:29 +0100 Subject: [PATCH 1/2] head: fix 'test_spams_newline' to check *against* newline spam The comment was introduced in commit 8320b1ec5f58a94372edce2477480fb0116df262, the test was introduced in commit c1f518e5864417e3db0a1dd84cd3e8438be3b089 claiming to be about "failing GNU head tests". However, a simple check reveals no such difference: ```console $ echo -n a | hd 00000000 61 |a| 00000001 $ echo -n a | head | hd # GNU head 00000000 61 |a| 00000001 $ echo -n a | cargo run -- head | hd 00000000 61 |a| 00000001 $ echo -n a | busybox head | hd 00000000 61 |a| 00000001 $ ``` Looking at the GNU tests directly, it seems that there is a similar, but different test. --- tests/by-util/test_head.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/by-util/test_head.rs b/tests/by-util/test_head.rs index 0b0e98aa1..b72e77281 100644 --- a/tests/by-util/test_head.rs +++ b/tests/by-util/test_head.rs @@ -99,10 +99,8 @@ fn test_verbose() { } #[test] -#[ignore] fn test_spams_newline() { - //this test is does not mirror what GNU does - new_ucmd!().pipe_in("a").succeeds().stdout_is("a\n"); + new_ucmd!().pipe_in("a").succeeds().stdout_is("a"); } #[test] From 27030e9f53417ea4ffbb2a057d960fdb9bf3b268 Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Tue, 20 Feb 2024 04:07:32 +0100 Subject: [PATCH 2/2] touch: re-enable test, fix typo in expected error messge --- tests/by-util/test_touch.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/by-util/test_touch.rs b/tests/by-util/test_touch.rs index 5cc0ba585..3151ca720 100644 --- a/tests/by-util/test_touch.rs +++ b/tests/by-util/test_touch.rs @@ -846,13 +846,11 @@ fn test_touch_dash() { } #[test] -// Chrono panics for now -#[ignore] fn test_touch_invalid_date_format() { let (_at, mut ucmd) = at_and_ucmd!(); let file = "test_touch_invalid_date_format"; ucmd.args(&["-m", "-t", "+1000000000000 years", file]) .fails() - .stderr_contains("touch: invalid date format ‘+1000000000000 years’"); + .stderr_contains("touch: invalid date format '+1000000000000 years'"); }