branch: externals/hyperbole
commit 0bab6487ea86f95c2548bf92dfa33a2a35f5b1be
Merge: de692018b3 c33b36319b
Author: Robert Weiner <r...@gnu.org>
Commit: GitHub <nore...@github.com>

    Merge pull request #514 from rswgnu/regression-gbut-act-for-web-link
    
    Add test for gbut:act on a web link
---
 ChangeLog          |  5 +++++
 test/hbut-tests.el | 14 +++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 68c46e4012..2f18b37e28 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-04-14  Mats Lidell  <ma...@gnu.org>
+
+* test/hbut-tests.el (hypb--gbut-act-with-web-link): Test for gbut:act
+    on a web link.
+
 2024-04-14  Bob Weiner  <r...@gnu.org>
 
 * hbut.el (ibut:create): Set 'name-start' and 'name-end' location attributes
diff --git a/test/hbut-tests.el b/test/hbut-tests.el
index d5f58d8e50..2e8e5caefa 100644
--- a/test/hbut-tests.el
+++ b/test/hbut-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <ma...@gnu.org>
 ;;
 ;; Orig-Date:    30-may-21 at 09:33:00
-;; Last-Mod:     16-Mar-24 at 23:44:27 by Mats Lidell
+;; Last-Mod:     14-Apr-24 at 21:52:52 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -780,6 +780,18 @@ See #10 for the proper way to add an ibutton name.
     (goto-char 8)  ;; ibtypes::mail-address !!
     (should (equal (hattr:get (ibut:at-p) 'categ) 'ibtypes::pathname))))
 
+(ert-deftest hypb--gbut-act-with-web-link ()
+  "Verify `gbut:act' with a web link calls browser."
+  (defvar global-but-file)
+  (let ((global-but-file (make-temp-file "gbut" nil ".txt"
+                                         "<[Link]> - 
\"https://savannah.gnu.org/projects/hyperbole/\"\n";)))
+    (unwind-protect
+        (mocklet ((gbut:file => global-but-file)
+                  ((browse-url "https://savannah.gnu.org/projects/hyperbole/";) 
=> t)
+                  (hpath:find-noselect => (find-file-noselect 
global-but-file)))
+          (gbut:act "Link"))
+      (hy-delete-file-and-buffer global-but-file))))
+
 ;; This file can't be byte-compiled without the `el-mock' package (because of
 ;; the use of the `with-mock' macro), which is not a dependency of Hyperbole.
 ;;  Local Variables:

Reply via email to