aboutsummaryrefslogtreecommitdiff
path: root/tests/test-wttrin--display-weather.el
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-wttrin--display-weather.el')
-rw-r--r--tests/test-wttrin--display-weather.el29
1 files changed, 12 insertions, 17 deletions
diff --git a/tests/test-wttrin--display-weather.el b/tests/test-wttrin--display-weather.el
index bca6a6c..99ea067 100644
--- a/tests/test-wttrin--display-weather.el
+++ b/tests/test-wttrin--display-weather.el
@@ -97,13 +97,14 @@ Weather report: Paris, France
(wttrin--display-weather "Tokyo" test-wttrin--display-weather-sample-raw-data)
(with-current-buffer "*wttr.in*"
- (goto-char (point-max))
- (forward-line -2)
- ;; Should contain help text
- (should (search-forward "Press:" nil t))
- (should (search-forward "[a] for another location" nil t))
- (should (search-forward "[g] to refresh" nil t))
- (should (search-forward "[q] to quit" nil t))))
+ ;; The two-column footer carries both groups; check a token from
+ ;; each column independently (document order mixes them).
+ (let ((text (buffer-string)))
+ (should (string-match-p "This view" text))
+ (should (string-match-p "Saved locations" text))
+ (should (string-match-p "\\[a\\] another" text))
+ (should (string-match-p "\\[s\\] save" text))
+ (should (string-match-p "\\[x\\] remove" text)))))
(test-wttrin--display-weather-teardown)))
;;; Boundary Cases
@@ -159,11 +160,8 @@ Empty string does not match ERROR pattern, so it's processed as data."
(test-wttrin--display-weather-setup)
(unwind-protect
(progn
- (let ((message-log-max t)
- (message-displayed nil))
- (cl-letf (((symbol-function 'message)
- (lambda (format-string &rest args)
- (setq message-displayed (apply #'format format-string args)))))
+ (let ((message-log-max t))
+ (testutil-wttrin-with-captured-message message-displayed
(wttrin--display-weather "InvalidCity" nil)
;; Should display error message
@@ -176,11 +174,8 @@ Empty string does not match ERROR pattern, so it's processed as data."
(test-wttrin--display-weather-setup)
(unwind-protect
(progn
- (let ((message-log-max t)
- (message-displayed nil))
- (cl-letf (((symbol-function 'message)
- (lambda (format-string &rest args)
- (setq message-displayed (apply #'format format-string args)))))
+ (let ((message-log-max t))
+ (testutil-wttrin-with-captured-message message-displayed
(wttrin--display-weather "BadLocation" testutil-wttrin-sample-error-response)
;; Should display error message