Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: Don't depend on tester's system timezone for success #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions test/test.el
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
;;;;; Formatting

(ert-deftest ts-format ()
(let ((ts (make-ts :year 2019 :month 7 :day 27 :hour 19 :minute 48 :second 08)))
(let ((ts (make-ts :year 2019 :month 7 :day 27 :hour 19 :minute 48 :second 08 :tz-offset "-0500")))
;; Following the pattern in the function:
(should (equal (ts-format ts) "2019-07-27 19:48:08 -0500"))
(should (equal (ts-format "%Y" ts) "2019"))
Expand Down Expand Up @@ -344,7 +344,8 @@
;; shouldn't cause Org to be loaded, so the user will probably have to do that.
(require 'org)
(let* ((org-ts-string "<2015-09-24 Thu .+1d>"))
(should (equal 1443070800.0 (ts-unix (ts-parse-org org-ts-string))))))
(should (equal (float-time (encode-time 0 0 0 24 9 2015))
(ts-unix (ts-parse-org org-ts-string))))))

(ert-deftest ts-parse-org-fill ()
(should-error (ts-parse-org-fill nil "<2015-09-24 Thu .+1d>"))
Expand Down Expand Up @@ -406,7 +407,9 @@
:hour-end nil :minute-end nil
:begin 230314 :end 230335 :post-blank 0
:repeater-type restart :repeater-value 1 :repeater-unit day))))
(should (equal 1443070800.0 (ts-unix (ts-parse-org-element org-ts)))))
(should (equal
(float-time (encode-time 0 0 0 24 9 2015))
(ts-unix (ts-parse-org-element org-ts)))))
(let ((org-ts-string "<2015-09-24 Thu .+1d>"))
(with-temp-buffer
(delay-mode-hooks
Expand All @@ -416,7 +419,7 @@
(should (->> (org-element-context)
(ts-parse-org-element)
(ts-unix)
(equal 1443070800.0)))))))
(equal (float-time (encode-time 0 0 0 24 9 2015)))))))))

;;;;; Other

Expand Down