From 93a92360e5ea514236366f978aa5a71e7662ba1a Mon Sep 17 00:00:00 2001 From: Bob Rogers 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