diff --git a/Eask b/Eask index e13a303..a2b3a0e 100644 --- a/Eask +++ b/Eask @@ -15,5 +15,6 @@ (source 'melpa) (depends-on "emacs" "26.1") +(depends-on "compat" "29") (setq network-security-level 'low) ; see https://github.com/jcs090218/setup-emacs-windows/issues/156#issuecomment-932956432 diff --git a/datetime-format-test.el b/datetime-format-test.el index 84ef4e4..1573881 100644 --- a/datetime-format-test.el +++ b/datetime-format-test.el @@ -6,7 +6,7 @@ ;; Created: 18 May 2016 ;; Version: 0.0.1 ;; Package-Requires: ((emacs "26.3")) -;; Keywords: datetime calendar +;; Keywords: lisp, datetime, calendar ;; Homepage: https://github.com/zonuexe/emacs-datetime ;; This file is NOT part of GNU Emacs. @@ -35,6 +35,9 @@ (require 'datetime-format) (require 'timecop) +(eval-when-compile + (require 'compat-28)) + (defvar datetime-format-original-tz (getenv "TZ")) (defmacro datetime-format--map (list function) @@ -46,20 +49,20 @@ This macro helps with expression expansion at compile time." ,@(mapcar function sequence)))) (ert-deftest datetime-format-test-format () - (setenv "TZ" "-9:30") ;; Australia/Darwin - (datetime-format--map '(("2009-02-14T09:01:30+09:30" (datetime-format 'atom)) - ("2009-02-14T09:01:30+09:30" (datetime-format 'atom (current-time))) - ("1970-01-01T09:30:00+09:30" (datetime-format 'atom 0)) - ("1970-01-01T00:00:00+00:00" (datetime-format 'atom 0 :timezone "UTC")) - ("2015-01-12T02:31:11+09:30" (datetime-format 'atom "2015-01-12 02:01:11")) - ("2015-01-12T02:01:11+02:00" (datetime-format 'atom "2015-01-12 02:01:11" - :timezone "Europe/Kiev")) - ("2015-01-11T17:01:11Z" (datetime-format 'atom-utc "2015-01-12 02:01:11")) - ("2009-02-13T18:31:30-05:00" (datetime-format 'atom nil - :timezone "America/New_York"))) - (lambda (pair) - (cl-destructuring-bind (expected expr) pair - `(timecop 1234567890 (should (string= ,expected (eval ,expr))))))) + (with-environment-variables (("TZ" "-9:30")) ;; Australia/Darwin + (datetime-format--map '(("2009-02-14T09:01:30+09:30" (datetime-format 'atom)) + ("2009-02-14T09:01:30+09:30" (datetime-format 'atom (current-time))) + ("1970-01-01T09:30:00+09:30" (datetime-format 'atom 0)) + ("1970-01-01T00:00:00+00:00" (datetime-format 'atom 0 :timezone "UTC")) + ("2015-01-12T02:31:11+09:30" (datetime-format 'atom "2015-01-12 02:01:11")) + ("2015-01-12T02:01:11+02:00" (datetime-format 'atom "2015-01-12 02:01:11" + :timezone "Europe/Kiev")) + ("2015-01-11T17:01:11Z" (datetime-format 'atom-utc "2015-01-12 02:01:11")) + ("2009-02-13T18:31:30-05:00" (datetime-format 'atom nil + :timezone "America/New_York"))) + (lambda (pair) + (cl-destructuring-bind (expected expr) pair + `(timecop 1234567890 (should (string= ,expected (eval ,expr)))))))) (setenv "TZ" datetime-format-original-tz)) (provide 'datetime-format-test) diff --git a/datetime-format.el b/datetime-format.el index ce4797f..092bf32 100644 --- a/datetime-format.el +++ b/datetime-format.el @@ -5,7 +5,7 @@ ;; Author: USAMI Kenta <tadsan@zonu.me> ;; Created: 16 May 2016 ;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) +;; Package-Requires: ((emacs "26.3") (compat "29")) ;; Keywords: lisp, datetime, calendar ;; Homepage: https://github.com/emacs-php/emacs-datetime