aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test-chime-make-tooltip.el7
-rw-r--r--tests/test-chime-notification-text.el9
-rw-r--r--tests/test-chime-propertize-modeline.el7
-rw-r--r--tests/test-chime-time-left.el21
4 files changed, 24 insertions, 20 deletions
diff --git a/tests/test-chime-make-tooltip.el b/tests/test-chime-make-tooltip.el
index 2c9cf37..7ace684 100644
--- a/tests/test-chime-make-tooltip.el
+++ b/tests/test-chime-make-tooltip.el
@@ -40,9 +40,10 @@
(setq chime-modeline-tooltip-max-events 5)
(setq chime-tooltip-header-format "Upcoming Events as of %a %b %d %Y @ %I:%M %p")
(setq chime-display-time-format-string "%I:%M %p")
- (setq chime-time-left-format-at-event "right now")
- (setq chime-time-left-format-short "in %M")
- (setq chime-time-left-format-long "in %H %M"))
+ (setq chime-time-left-formats
+ (list (cons 'at-event "right now")
+ (cons 'short "in %M")
+ (cons 'long "in %H %M"))))
(defun test-chime-make-tooltip-teardown ()
"Teardown function run after each test."
diff --git a/tests/test-chime-notification-text.el b/tests/test-chime-notification-text.el
index 2446004..a707d29 100644
--- a/tests/test-chime-notification-text.el
+++ b/tests/test-chime-notification-text.el
@@ -40,9 +40,10 @@
;; Reset notification text format to default
(setq chime-notification-text-format "%t at %T (%u)")
;; Reset time-left formats to defaults
- (setq chime-time-left-format-at-event "right now")
- (setq chime-time-left-format-short "in %M")
- (setq chime-time-left-format-long "in %H %M")
+ (setq chime-time-left-formats
+ (list (cons 'at-event "right now")
+ (cons 'short "in %M")
+ (cons 'long "in %H %M")))
;; Reset title truncation to default (no truncation)
(setq chime-max-title-length nil))
@@ -331,7 +332,7 @@ REFACTORED: Uses dynamic timestamps"
(str-interval (cons (test-timestamp-string time) '(10 . medium)))
(event '((title . "Meeting")))
(chime-notification-text-format "%t (%u)")
- (chime-time-left-format-short "in %mm"))
+ (chime-time-left-formats '((at-event . "right now") (short . "in %mm") (long . "in %H %M"))))
(let ((result (chime--notification-text str-interval event)))
(should (stringp result))
(should (string-equal "Meeting (in 10m)" result))))
diff --git a/tests/test-chime-propertize-modeline.el b/tests/test-chime-propertize-modeline.el
index 3856831..cc0dbb2 100644
--- a/tests/test-chime-propertize-modeline.el
+++ b/tests/test-chime-propertize-modeline.el
@@ -38,9 +38,10 @@
(chime-create-test-base-dir)
(setq chime-tooltip-header-format "Upcoming Events as of %a %b %d %Y @ %I:%M %p")
(setq chime-display-time-format-string "%I:%M %p")
- (setq chime-time-left-format-at-event "right now")
- (setq chime-time-left-format-short "in %M")
- (setq chime-time-left-format-long "in %H %M"))
+ (setq chime-time-left-formats
+ (list (cons 'at-event "right now")
+ (cons 'short "in %M")
+ (cons 'long "in %H %M"))))
(defun test-chime-propertize-teardown ()
"Teardown function."
diff --git a/tests/test-chime-time-left.el b/tests/test-chime-time-left.el
index 25b41d9..b9bd176 100644
--- a/tests/test-chime-time-left.el
+++ b/tests/test-chime-time-left.el
@@ -35,9 +35,10 @@
"Setup function run before each test."
(chime-create-test-base-dir)
;; Reset format strings to defaults
- (setq chime-time-left-format-at-event "right now")
- (setq chime-time-left-format-short "in %M")
- (setq chime-time-left-format-long "in %H %M"))
+ (setq chime-time-left-formats
+ (list (cons 'at-event "right now")
+ (cons 'short "in %M")
+ (cons 'long "in %H %M"))))
(defun test-chime-time-left-teardown ()
"Teardown function run after each test."
@@ -216,7 +217,7 @@
(test-chime-time-left-setup)
(unwind-protect
(progn
- (setq chime-time-left-format-short "in %mm")
+ (setf (alist-get 'short chime-time-left-formats) "in %mm")
(let ((result (chime--time-left 300))) ; 5 minutes
(should (stringp result))
(should (string-equal "in 5m" result))))
@@ -227,7 +228,7 @@
(test-chime-time-left-setup)
(unwind-protect
(progn
- (setq chime-time-left-format-long "in %hh %mm")
+ (setf (alist-get 'long chime-time-left-formats) "in %hh %mm")
(let ((result (chime--time-left 5820))) ; 1 hour 37 minutes
(should (stringp result))
(should (string-equal "in 1h 37m" result))))
@@ -238,7 +239,7 @@
(test-chime-time-left-setup)
(unwind-protect
(progn
- (setq chime-time-left-format-long "(%h hr %m min)")
+ (setf (alist-get 'long chime-time-left-formats) "(%h hr %m min)")
(let ((result (chime--time-left 5820))) ; 1 hour 37 minutes
(should (stringp result))
(should (string-equal "(1 hr 37 min)" result))))
@@ -249,7 +250,7 @@
(test-chime-time-left-setup)
(unwind-protect
(progn
- (setq chime-time-left-format-long "%hh%mm")
+ (setf (alist-get 'long chime-time-left-formats) "%hh%mm")
(let ((result (chime--time-left 5820))) ; 1 hour 37 minutes
(should (stringp result))
(should (string-equal "1h37m" result))))
@@ -260,7 +261,7 @@
(test-chime-time-left-setup)
(unwind-protect
(progn
- (setq chime-time-left-format-at-event "NOW!")
+ (setf (alist-get 'at-event chime-time-left-formats) "NOW!")
(let ((result (chime--time-left 0)))
(should (stringp result))
(should (string-equal "NOW!" result))))
@@ -271,7 +272,7 @@
(test-chime-time-left-setup)
(unwind-protect
(progn
- (setq chime-time-left-format-short "%m min")
+ (setf (alist-get 'short chime-time-left-formats) "%m min")
(let ((result (chime--time-left 300))) ; 5 minutes
(should (stringp result))
(should (string-equal "5 min" result))))
@@ -282,7 +283,7 @@
(test-chime-time-left-setup)
(unwind-protect
(progn
- (setq chime-time-left-format-long "🕐 %hh%mm")
+ (setf (alist-get 'long chime-time-left-formats) "🕐 %hh%mm")
(let ((result (chime--time-left 5820))) ; 1 hour 37 minutes
(should (stringp result))
(should (string-equal "🕐 1h37m" result))))