GNU bug report logs - #52209
28.0.60; [PATCH] date-to-time fails on pure dates

Previous Next

Package: emacs;

Reported by: Bob Rogers <rogers-emacs <at> rgrjr.homedns.org>

Date: Tue, 30 Nov 2021 21:49:02 UTC

Severity: normal

Found in version 28.0.60

Full log


View this message in rfc822 format

From: Bob Rogers <rogers-emacs <at> rgrjr.homedns.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, Andreas Schwab <schwab <at> linux-m68k.org>, 52209 <at> debbugs.gnu.org, Paul Eggert <eggert <at> cs.ucla.edu>
Subject: bug#52209: 28.0.60; [PATCH] date-to-time fails on pure dates
Date: Thu, 24 Feb 2022 21:58:17 -0500
[Message part 1 (text/plain, inline)]
   From: Bob Rogers <rogers-emacs <at> rgrjr.homedns.org>
   Date: Thu, 24 Feb 2022 21:32:27 -0500

      From: Lars Ingebrigtsen <larsi <at> gnus.org>
      Date: Fri, 25 Feb 2022 03:16:56 +0100

      Bob Rogers <rogers-emacs <at> rgrjr.homedns.org> writes:

      > Here it is; there should be no changes from what I last sent other than
      > from the suggestions you and Andreas made.  Thanks,

      I got a test error:

   Hmm.  I bet we have a timezone issue . . .

Yep; here's a fix, to be applied to the previous patch.

					-- Bob

[0001-Fix-an-ietf-drums-parse-date-test-without-TZ.patch (text/x-patch, inline)]
From 93a92360e5ea514236366f978aa5a71e7662ba1a Mon Sep 17 00:00:00 2001
From: Bob Rogers <rogers <at> rgrjr.com>
Date: Thu, 24 Feb 2022 21:55:30 -0500
Subject: [PATCH] Fix an ietf-drums-parse-date test without TZ

* test/lisp/mail/ietf-drums-date-tests.el:
   + (ietf-drums-date-tests):  Bug fix:  Input to ietf-drums-parse-date
     must have a timezone, otherwise the output depends on the test
     environment TZ.  Also add some tests without TZ, & fix indentation.
---
 test/lisp/mail/ietf-drums-date-tests.el | 36 +++++++++++++++++--------
 1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/test/lisp/mail/ietf-drums-date-tests.el b/test/lisp/mail/ietf-drums-date-tests.el
index 2d4b39dfae..5b798077ff 100644
--- a/test/lisp/mail/ietf-drums-date-tests.el
+++ b/test/lisp/mail/ietf-drums-date-tests.el
@@ -72,18 +72,32 @@ ietf-drums-date-tests
                   ("Friday, 21 Sep 2018 13:47:58 PDT"
                    (58 47 13 21 9 2018 5 t -25200)
                    (23461 22782))
-                  ("Friday, 21 Sep 2018 13:47:58"
-                   (58 47 13 21 9 2018 5 -1 nil)
+                  ("Friday, 21 Sep 2018 13:47:58 EDT"
+                   (58 47 13 21 9 2018 5 t -14400)
                    (23461 11982))))
-            (let* ((input (car case))
-                   (parsed (cadr case))
-                   (encoded (caddr case)))
-              ;; The input should parse the same without RFC822.
-              (should (equal (ietf-drums-parse-date-string input) parsed))
-              (should (equal (ietf-drums-parse-date-string input nil t) parsed))
-              ;; Check the encoded date (the official output, though
-              ;; the decoded-time is easier to debug).
-              (should (equal (ietf-drums-parse-date input) encoded))))
+    (let* ((input (car case))
+           (parsed (cadr case))
+           (encoded (caddr case)))
+      ;; The input should parse the same without RFC822.
+      (should (equal (ietf-drums-parse-date-string input) parsed))
+      (should (equal (ietf-drums-parse-date-string input nil t) parsed))
+      ;; Check the encoded date (the official output, though the
+      ;; decoded-time is easier to debug).
+      (should (equal (ietf-drums-parse-date input) encoded))))
+
+  ;; Test a few without timezones.
+  (dolist (case '(("Mon, 22 Feb 2016 19:35:42"
+                   (42 35 19 22 2 2016 1 -1 nil))
+                  ("Friday, 21 Sep 2018 13:47:58"
+                   (58 47 13 21 9 2018 5 -1 nil))))
+    (let* ((input (car case))
+           (parsed (cadr case)))
+      ;; The input should parse the same without RFC822.
+      (should (equal (ietf-drums-parse-date-string input) parsed))
+      (should (equal (ietf-drums-parse-date-string input nil t) parsed))
+      ;; We can't check the encoded date here because it will differ
+      ;; depending on the TZ of the test environment.
+      ))
 
   ;; Two-digit years are not allowed by the "modern" format.
   (should (equal (ietf-drums-parse-date-string "22 Feb 16 19:35:42 +0100")
-- 
2.34.1


This bug report was last modified 3 years and 172 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.