From b99beaad18f9ec02f626a39ebb1f87b55975b4d5 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 24 Jan 2021 21:13:05 -0500 Subject: [PATCH] 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. --- testing/lisp/test-org-macs.el | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/testing/lisp/test-org-macs.el b/testing/lisp/test-org-macs.el index 7db17cc37..efa992a03 100644 --- a/testing/lisp/test-org-macs.el +++ b/testing/lisp/test-org-macs.el @@ -103,5 +103,34 @@ (org-test-with-temp-text "xx abc 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 "")) + 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