summaryrefslogtreecommitdiff
path: root/tests/testutil-wttrin.el
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testutil-wttrin.el')
-rw-r--r--tests/testutil-wttrin.el15
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/testutil-wttrin.el b/tests/testutil-wttrin.el
index 685cc09..42c8c21 100644
--- a/tests/testutil-wttrin.el
+++ b/tests/testutil-wttrin.el
@@ -72,10 +72,10 @@
`(let ((wttrin-unit-system ,unit-system))
,@body))
-(defmacro testutil-wttrin-with-cache-ttl (ttl &rest body)
- "Execute BODY with wttrin-cache-ttl temporarily set to TTL."
+(defmacro testutil-wttrin-with-refresh-interval (interval &rest body)
+ "Execute BODY with wttrin-refresh-interval temporarily set to INTERVAL."
(declare (indent 1))
- `(let ((wttrin-cache-ttl ,ttl))
+ `(let ((wttrin-refresh-interval ,interval))
,@body))
(defmacro testutil-wttrin-with-cache-max (max-entries &rest body)
@@ -110,6 +110,15 @@
(funcall callback nil)))))
,@body))
+;;; Mode-line Cache Helpers
+
+(defun testutil-wttrin-set-mode-line-cache (data &optional age-seconds)
+ "Set mode-line cache to DATA, optionally aged by AGE-SECONDS."
+ (let ((timestamp (if age-seconds
+ (- (float-time) age-seconds)
+ (float-time))))
+ (setq wttrin--mode-line-cache (cons timestamp data))))
+
;;; Test Setup and Teardown
(defun testutil-wttrin-setup ()