aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorƁukasz Stelmach2024-02-07 14:37:39 +0100
committerStefan Kangas2025-03-01 04:38:06 +0100
commitbc33b70b280933470b252f2a877fd50e4aed42ba (patch)
tree1bff2633ecb58a10aadc0f28a37868e4d9093f3a /test
parentc0ca272bd7cbab5a2013e112f171e1d7fda65216 (diff)
downloademacs-bc33b70b280933470b252f2a877fd50e4aed42ba.tar.gz
emacs-bc33b70b280933470b252f2a877fd50e4aed42ba.zip
Fix handling of delta values with negative month field
* lisp/calendar/time-date.el (decoded-time-add): If the new variable is less then zero, the year needs to be decremented by quotient of new and 12 increased by one. * test/lisp/calendar/time-date-tests.el (test-decoded-add): Add applicable test cases. (Bug#68969)
Diffstat (limited to 'test')
-rw-r--r--test/lisp/calendar/time-date-tests.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/lisp/calendar/time-date-tests.el b/test/lisp/calendar/time-date-tests.el
index b8d3381528e..7df1e1b0da7 100644
--- a/test/lisp/calendar/time-date-tests.el
+++ b/test/lisp/calendar/time-date-tests.el
@@ -161,6 +161,18 @@
161 (should (equal (decoded-time-add time (mdec :month 10)) 161 (should (equal (decoded-time-add time (mdec :month 10))
162 '(12 15 16 8 5 2020 1 t 7200))) 162 '(12 15 16 8 5 2020 1 t 7200)))
163 163
164 (should (equal (decoded-time-add time (mdec :month -1))
165 '(12 15 16 8 6 2019 1 t 7200)))
166
167 (should (equal (decoded-time-add time (mdec :month -10))
168 '(12 15 16 8 9 2018 1 t 7200)))
169
170 (should (equal (decoded-time-add time (mdec :month -14))
171 '(12 15 16 8 5 2018 1 t 7200)))
172
173 (should (equal (decoded-time-add time (mdec :month -24))
174 '(12 15 16 8 7 2017 1 t 7200)))
175
164 (should (equal (decoded-time-add time (mdec :day 1)) 176 (should (equal (decoded-time-add time (mdec :day 1))
165 '(12 15 16 9 7 2019 1 t 7200))) 177 '(12 15 16 9 7 2019 1 t 7200)))
166 178