org-macs: Add basic tests for org-matcher-time

* testing/lisp/test-org-macs.el (test-org-matcher-time): Add tests.

This includes of a test for the missing hour modifier added in the
previous commit.
This commit is contained in:
Kyle Meyer 2021-01-24 21:13:05 -05:00
parent aeb9f036ff
commit b99beaad18
1 changed files with 29 additions and 0 deletions

View File

@ -103,5 +103,34 @@
(org-test-with-temp-text "xx abc<point> xx"
(org-in-regexp "abc" nil t))))
;;; Time
(ert-deftest test-org-matcher-time ()
"Test `org-matcher-time'."
(let ((system-time-locale "en_US"))
(org-test-at-time "<2021-01-11 Mon 13:00>"
(should (equal (list 0 0 13 11 1 2021)
(butlast (org-decode-time (org-matcher-time "<now>"))
3)))
(should (equal (list 0 0 0 14 1 2021)
(butlast (org-decode-time (org-matcher-time "<+3d>"))
3)))
(should (equal (list 0 0 0 9 1 2021)
(butlast (org-decode-time (org-matcher-time "<-2d>"))
3)))
(should (equal (list 0 0 0 18 1 2021)
(butlast (org-decode-time (org-matcher-time "<+1w>"))
3)))
(should (equal (list 0 0 17 11 1 2021)
(butlast (org-decode-time (org-matcher-time "<+4h>"))
3)))
(should (equal (list 0 0 11 11 1 2021)
(butlast (org-decode-time (org-matcher-time "<-2h>"))
3)))
(should (equal (list 0 0 3 12 1 2021)
(butlast (org-decode-time (org-matcher-time "<+14h>"))
3))))))
(provide 'test-org-macs)
;;; test-org-macs.el ends here