master ba331c27f14: Port some timestamp tests to 32-bit time_t
Paul Eggert <[email protected]> Fri, 24 Jul 2026 15:33:16 -0400 (EDT)
| Newsgroups | gmane.emacs.diffs |
|---|---|
| Message-ID | <[email protected]> |
branch: master commit ba331c27f14adb429ef21fdf3d5c62febb7564d3 Author: Paul Eggert <[email protected]> Commit: Paul Eggert <[email protected]> Port some timestamp tests to 32-bit time_t * test/lisp/calendar/icalendar-recur-tests.el: (ict:recur-tz-observance-on): * test/lisp/gnus/gnus-icalendar-tests.el (gnus-icalendary-byday): Skip these tests, which use timestamps before 1970, if the platform does not support that, e.g., unsigned 32-bit time_t, or signed 32-bit time_t for timestamps before 1901. --- test/lisp/calendar/icalendar-recur-tests.el | 3 ++- test/lisp/gnus/gnus-icalendar-tests.el | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/test/lisp/calendar/icalendar-recur-tests.el b/test/lisp/calendar/icalendar-recur-tests.el index 77e6f89744f..c864b8c15fa 100644 --- a/test/lisp/calendar/icalendar-recur-tests.el +++ b/test/lisp/calendar/icalendar-recur-tests.el @@ -1286,7 +1286,8 @@ from 1967 to at least 2026.") (let* ((dt (ical:make-date-time :year 1900 :month 1 :day 1 :hour 12 :minute 0 :second 0 :zone ict:est :dst nil)) - (ts (encode-time dt))) + (ts (ignore-errors (encode-time dt)))) + (skip-unless ts) ; Skip the test on platforms that can't represent 1900. (should (null (icr:tz-observance-on dt ict:tz-eastern))) (should (null (icr:tz-observance-on ts ict:tz-eastern)))) diff --git a/test/lisp/gnus/gnus-icalendar-tests.el b/test/lisp/gnus/gnus-icalendar-tests.el index e668becd54d..7b26da3a3cf 100644 --- a/test/lisp/gnus/gnus-icalendar-tests.el +++ b/test/lisp/gnus/gnus-icalendar-tests.el @@ -116,6 +116,11 @@ END:VCALENDAR ;; FIXME: is "icalendary" (not "icalendar") intentional, here and below? (ert-deftest gnus-icalendary-byday () "" + ;; Skip the test if encode-time rejects old dates. + ;; This test assumes underlying timekeeping works for dates in the 1600s, + ;; but POSIX requires only dates starting in 1970. + (skip-unless (ignore-errors (encode-time '(0 0 0 1 1 1601 1 nil -18000)))) + (let* ((tz (getenv "TZ")) (icalendar-pre-parsing-hook ;; clean up " <at> " addresses so the parser doesn't choke...