Thanks for the feedback, these all look like good suggestions (always happy to learn about new testing convenience methods!). Let me get the patch amended.
Cheers, Derek On Sun, Apr 5, 2026 at 12:46 PM Morgan Smith <[email protected]> wrote: > Thanks for the patch! I've been meaning to get around to testing DST > stuff. I haven't tried this patch out yet but wanted to comment on the > testing style a little. Just nitpicks really so please bear with me. > > Derek Chen-Becker <[email protected]> writes: > > > +(ert-deftest test-org/org-timestamp-change-dst () > > + "Test that `org-timestamp-change' properly errors at DST boundaries." > > + ;; Using the process environment to ensure the correct timezone for > this test > > + (let ((process-environment (cons "TZ=America/New_York" > process-environment))) > > You can use the macro `org-test-with-timezone' like what is done in > `test-org-habit/dst'. > > > + ;; Shifting the hour from 3:05 to 2:05 falls into the gap and > should error > > + (should-error > > + (org-test-with-temp-text "<2026-03-08 Sun 03:05>" > > + (forward-char 16) ;; Put the cursor on > the hour > > + (org-timestamp-change -1 'hour) > > Instead of the `forward-char', you can simply do: > > (org-test-with-temp-text "<2026-03-08 Sun 03<point>:05>" > > Also you shouldn't need to set the point since you are passing in a > value to the optional argument WHAT. > > > + :type 'user-error > > + )) > > + ;; Shifting the minutes from 3:00 to 2:55 falls into the gap and > should error > > + (should-error > > + (org-test-with-temp-text "<2026-03-08 Sun 03:00>" > > + (forward-char 19) ;; Put the cursor on > the minute > > + (org-timestamp-change -1 'minute) > > + :type 'user-error > > + )))) > > First, I would love a comment telling me what DST is occuring like the > comment I wrote in `test-org-habit/dst' which says: > > ;; DST transition (spring forward) [2009-03-08 01:59] -> [2009-03-08 03:00] > > Second, I would love to see tests for the other DST transition (fall > back). > > > I hope you find these comments helpful! I'm really excited to see > progress on DST bugs! > -- +---------------------------------------------------------------+ | Derek Chen-Becker | | GPG Key available at https://keybase.io/dchenbecker and | | https://pgp.mit.edu/pks/lookup?search=derek%40chen-becker.org | | Fngrprnt: EB8A 6480 F0A3 C8EB C1E7 7F42 AFC5 AFEE 96E4 6ACC | +---------------------------------------------------------------+
