Le 05/01/2026 à 01:11, Collin Funk a écrit :
Interesting, thanks!

If this is ok,  I will add some tests, i don't think it is properly covered 
today!
Yep, I don't see it anywhere. Some tests in date.pl would be helpful,
thanks!

Attached! it should do it!

Thanks
Sylvestre

From e94b36bb1d09d82ce97b399f61170a76c23fd3a5 Mon Sep 17 00:00:00 2001
From: Sylvestre Ledru <[email protected]>
Date: Wed, 7 Jan 2026 23:51:06 +0100
Subject: [PATCH] tests: date: test parenthesis comment handling

  * tests/date/date.pl: Add the check.
---
 tests/date/date.pl | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tests/date/date.pl b/tests/date/date.pl
index 6971a7c7c..986f82bff 100755
--- a/tests/date/date.pl
+++ b/tests/date/date.pl
@@ -319,6 +319,17 @@ my @Tests =
 
      # test with %%-N
      ['pct-pct', '+%%-N', {OUT => '%-N'}],
+
+     # Test parenthesis comment handling
+     # Single parenthesis - should be treated as empty string (midnight today)
+     ['paren-1', "-d '(' +'%H:%M:%S'", {OUT=>"00:00:00"}],
+
+     # Parenthesis with preceding text - comment should be ignored
+     ['paren-2', "-d '1(ignore this comment' +'%H:%M:%S'", {OUT=>"01:00:00"}],
+
+     # Parenthesis with date - comment should be ignored
+     ['paren-3', "-d '2026-01-05(this is a comment' -u +'%Y-%m-%d'",
+      {OUT=>"2026-01-05"}],
     );
 
 # Repeat the cross-dst test, using Jan 1, 2005 and every interval from 1..364.
-- 
2.51.0

Reply via email to