Skip to content

Commit 7ef5a18

Browse files
committed
ilink-test - Add new test of ilink ibtype
1 parent b585b5f commit 7ef5a18

3 files changed

Lines changed: 37 additions & 3 deletions

File tree

ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
2026-06-18 Bob Weiner <rsw@gnu.org>
22

3+
* test/hibtypes-tests.el (ibtypes::ilink-test): Add.
4+
35
* hywiki.el (hywiki-include-special-modes): Add to recognize HyWikiWords in
46
particular special major modes, like eww and elfeed ones.
57
(hywiki-potential-buffer-p): Use above setting in this function.

hactypes.el

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
;; Author: Bob Weiner
44
;;
55
;; Orig-Date: 23-Sep-91 at 20:34:36
6-
;; Last-Mod: 14-Jun-26 at 16:06:31 by Bob Weiner
6+
;; Last-Mod: 18-Jun-26 at 10:01:03 by Bob Weiner
77
;;
88
;; SPDX-License-Identifier: GPL-3.0-or-later
99
;;
@@ -587,7 +587,9 @@ on the implicit button to which to link."
587587
(ibut:key-to-label name-key)
588588
key-src))))
589589

590-
590+
;; !! Left over code from an earlier version of `link-to-ibut' in case
591+
;; is ever needed for reference. rsw - 2026-06-18
592+
;;
591593
;; (if key-src
592594
;; (unless (and (get-buffer key-src)
593595
;; (not (hypb:buffer-file-name (get-buffer key-src))))

test/hibtypes-tests.el

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
;; Author: Mats Lidell <matsl@gnu.org>
44
;;
55
;; Orig-Date: 20-Feb-21 at 23:45:00
6-
;; Last-Mod: 14-Jun-26 at 15:57:15 by Bob Weiner
6+
;; Last-Mod: 18-Jun-26 at 11:52:57 by Bob Weiner
77
;;
88
;; SPDX-License-Identifier: GPL-3.0-or-later
99
;;
@@ -565,6 +565,36 @@ file.el:10:20: Warning: Message
565565
(should (ibtypes::org-id))))
566566
(hy-delete-file-and-buffer file))))
567567

568+
(ert-deftest ibtypes::ilink-test ()
569+
"Verify link to ibut in same buffer."
570+
(let ((file (make-temp-file "ilink-test")))
571+
(unwind-protect
572+
(progn
573+
(find-file file)
574+
(insert "<ilink: Button1 >\n<[Button1]> <identity 1>")
575+
(goto-char 4)
576+
(should (ibtype:test-p 'ilink))
577+
(should (= (ibut:act) 1))
578+
579+
;; ilink with file name
580+
(erase-buffer)
581+
(insert "<[Button2]> <identity 2>")
582+
(save-excursion
583+
(with-temp-buffer
584+
(insert (format "<ilink: Button2:\"%s\">\n" file))
585+
(goto-char 4)
586+
(should (ibtype:test-p 'ilink))
587+
(should (= (ibut:act) 2))))
588+
589+
(erase-buffer)
590+
(insert "<ilink: Button3 >\n<[Other]> <identity 3>")
591+
(goto-char 4)
592+
(let ((err (should-error (ibtypes::ilink))))
593+
(should
594+
(string-match-p (rx "No button " (any punct) "Button3" (any punct) " in")
595+
(cadr err)))))
596+
(hy-delete-file-and-buffer file))))
597+
568598
;; This file can't be byte-compiled without the `el-mock' package (because of
569599
;; the use of the `with-mock' macro), which is not a dependency of Hyperbole.
570600
;; Local Variables:

0 commit comments

Comments
 (0)