aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias EngdegÄrd2021-01-13 14:16:57 +0100
committerMattias EngdegÄrd2021-01-13 14:16:57 +0100
commit820bd0e09a913e0bc9e1fc9fe007f6a653be2808 (patch)
tree4ae7813bcb9bffa5b97aae06d51cd24611d2dba9
parentc734ba68623279d814e857ddc536421a08c38f34 (diff)
downloademacs-820bd0e09a913e0bc9e1fc9fe007f6a653be2808.tar.gz
emacs-820bd0e09a913e0bc9e1fc9fe007f6a653be2808.zip
Stabilise lunar-phase-list test (bug#45818)
The test reference data was produced with accidental interference from the system daylight saving in effect at the time. Prevent that from occurring again and correct the data. * test/lisp/calendar/lunar-tests.el (with-lunar-test): Switch to UTC and make sure daylight saving adjustment is disabled. Use normal time presentation for maintainability. * test/lisp/calendar/lunar-tests.el (lunar-test-phase): Adjust to UTC. (lunar-test-phase-list): Adjust to UTC with correct times. Enable the test by removing its :unstable mark.
-rw-r--r--test/lisp/calendar/lunar-tests.el38
1 files changed, 18 insertions, 20 deletions
diff --git a/test/lisp/calendar/lunar-tests.el b/test/lisp/calendar/lunar-tests.el
index 5f1f6782f1a..268dcfdb550 100644
--- a/test/lisp/calendar/lunar-tests.el
+++ b/test/lisp/calendar/lunar-tests.el
@@ -27,39 +27,37 @@
27(defmacro with-lunar-test (&rest body) 27(defmacro with-lunar-test (&rest body)
28 `(let ((calendar-latitude 40.1) 28 `(let ((calendar-latitude 40.1)
29 (calendar-longitude -88.2) 29 (calendar-longitude -88.2)
30 (calendar-location-name "Urbana, IL") 30 (calendar-location-name "Paris")
31 (calendar-time-zone -360) 31 (calendar-time-zone 0)
32 (calendar-standard-time-zone-name "CST") 32 (calendar-standard-time-zone-name "UTC")
33 (calendar-time-display-form '(12-hours ":" minutes am-pm))) 33 ;; Make sure daylight saving is disabled to avoid interference
34 ;; from the system settings (see bug#45818).
35 (calendar-daylight-savings-starts nil)
36 (calendar-time-display-form '(24-hours ":" minutes)))
34 ,@body)) 37 ,@body))
35 38
36(ert-deftest lunar-test-phase () 39(ert-deftest lunar-test-phase ()
37 (with-lunar-test 40 (with-lunar-test
38 (should (equal (lunar-phase 1) 41 (should (equal (lunar-phase 1)
39 '((1 7 1900) "11:40pm" 1 ""))))) 42 '((1 8 1900) "05:40" 1 "")))))
40 43
41(ert-deftest lunar-test-eclipse-check () 44(ert-deftest lunar-test-eclipse-check ()
42 (with-lunar-test 45 (with-lunar-test
43 (should (equal (eclipse-check 1 1) "** Eclipse **")))) 46 (should (equal (eclipse-check 1 1) "** Eclipse **"))))
44 47
45;; This fails in certain time zones.
46;; Eg TZ=America/Phoenix make lisp/calendar/lunar-tests
47;; Similarly with TZ=UTC.
48;; Daylight saving related?
49(ert-deftest lunar-test-phase-list () 48(ert-deftest lunar-test-phase-list ()
50 :tags '(:unstable)
51 (with-lunar-test 49 (with-lunar-test
52 (should (equal (lunar-phase-list 3 1871) 50 (should (equal (lunar-phase-list 3 1871)
53 '(((3 20 1871) "11:03pm" 0 "") 51 '(((3 21 1871) "04:03" 0 "")
54 ((3 29 1871) "1:46am" 1 "** Eclipse **") 52 ((3 29 1871) "06:46" 1 "** Eclipse **")
55 ((4 5 1871) "9:20am" 2 "") 53 ((4 5 1871) "14:20" 2 "")
56 ((4 12 1871) "12:57am" 3 "** Eclipse possible **") 54 ((4 12 1871) "05:57" 3 "** Eclipse possible **")
57 ((4 19 1871) "2:06pm" 0 "") 55 ((4 19 1871) "19:06" 0 "")
58 ((4 27 1871) "6:49pm" 1 "") 56 ((4 27 1871) "23:49" 1 "")
59 ((5 4 1871) "5:57pm" 2 "") 57 ((5 4 1871) "22:57" 2 "")
60 ((5 11 1871) "9:29am" 3 "") 58 ((5 11 1871) "14:29" 3 "")
61 ((5 19 1871) "5:46am" 0 "") 59 ((5 19 1871) "10:46" 0 "")
62 ((5 27 1871) "8:02am" 1 "")))))) 60 ((5 27 1871) "13:02" 1 ""))))))
63 61
64(ert-deftest lunar-test-new-moon-time () 62(ert-deftest lunar-test-new-moon-time ()
65 (with-lunar-test 63 (with-lunar-test