From 0ac16f41d593ab880a2b8feddb0383cfce14ff3e Mon Sep 17 00:00:00 2001 From: Mats Lidell Date: Mon, 29 Jun 2026 14:25:03 +0200 Subject: [PATCH] Update test to check error message * test/hui-tests.el (hui--hbut-act--links): Check error messages matches elink and glink. Remove old comments. --- ChangeLog | 5 +++++ test/hui-tests.el | 21 +++++++++------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1fb22bb3..82677e17 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2026-06-29 Mats Lidell + +* test/hui-tests.el (hui--hbut-act--links): Check error messages + matches elink and glink. Remove old comments. + 2026-06-28 Bob Weiner * hywiki.el (hywiki-include-special-modes): Add HyWiki support in csv, diff --git a/test/hui-tests.el b/test/hui-tests.el index c1c98e98..847439b0 100644 --- a/test/hui-tests.el +++ b/test/hui-tests.el @@ -3,7 +3,7 @@ ;; Author: Mats Lidell ;; ;; Orig-Date: 30-Jan-21 at 12:00:00 -;; Last-Mod: 28-Jun-26 at 14:11:17 by Bob Weiner +;; Last-Mod: 29-Jun-26 at 14:23:29 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -35,9 +35,6 @@ (ert-deftest hui--hbut-act--links () "Verify `hui:hbut-act' finds the ilink but not elink and glink." - ;; What should happen for elink and glink is not clear to me so I'm - ;; keeping the current behavior below that succeeds even for those - ;; cases. (with-temp-buffer (set-window-buffer (selected-window) (current-buffer)) (insert "\ @@ -49,27 +46,27 @@ (action-key) (should (string-match-p "123\n" cap))) - ;; This should lead to possibly "No action defined for this - ;; context; try another location" or something similar. (erase-buffer) (insert "\ <[Command]> ") (goto-char 4) - (ert-with-message-capture cap - (should-error (action-key))) + (let ((err (should-error (action-key) :type 'error))) + (should + (string-match-p (rx "No button " punct "Command" punct " in") + (cadr err)))) - ;; This should lead to possibly "No action defined for this - ;; context; try another location" or something similar. (erase-buffer) (insert "\ <[Command]> ") (goto-char 4) - (ert-with-message-capture cap - (should-error (action-key))))) + (let ((err (should-error (action-key) :type 'error))) + (should + (string-match-p "No global button found for label: Command" + (cadr err)))))) (ert-deftest hui-gbut-edit-link-to-file-button () "A global button with action type link-to-file shall be possible to edit."