Skip to content

Commit d7354c0

Browse files
authored
Merge pull request #981 from rswgnu/rsw
ilink-test - Add new test of ilink ibtype
2 parents cd66f41 + af15696 commit d7354c0

3 files changed

Lines changed: 24 additions & 14 deletions

File tree

ChangeLog

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

3+
* test/hibtypes-tests.el (ibtypes::ilink-test): Add and ensure only one
4+
instance of this test.
5+
36
* hywiki.el (hywiki-include-special-modes): Add to recognize HyWikiWords in
47
particular special major modes, like eww and elfeed ones.
58
(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: 17 additions & 12 deletions
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 12:04:02 by Bob Weiner
77
;;
88
;; SPDX-License-Identifier: GPL-3.0-or-later
99
;;
@@ -373,26 +373,31 @@
373373
;; ilink
374374
(ert-deftest ibtypes::ilink-test ()
375375
"Verify link to ibut in same buffer."
376-
(let ((file (make-temp-file "ilink")))
376+
(let ((file (make-temp-file "ilink-test")))
377377
(unwind-protect
378378
(progn
379379
(find-file file)
380-
(insert "\
381-
<ilink: Button >
382-
<[Button]> <identity \"ARG\">
383-
")
380+
(insert "<ilink: Button1 >\n<[Button1]> <identity 1>")
384381
(goto-char 4)
385-
(should (string= "ARG" (ibtypes::ilink)))
382+
(should (ibtype:test-p 'ilink))
383+
(should (= (ibut:act) 1))
384+
385+
;; ilink with file name
386+
(erase-buffer)
387+
(insert "<[Button2]> <identity 2>")
388+
(save-excursion
389+
(with-temp-buffer
390+
(insert (format "<ilink: Button2:\"%s\">\n" file))
391+
(goto-char 4)
392+
(should (ibtype:test-p 'ilink))
393+
(should (= (ibut:act) 2))))
386394

387395
(erase-buffer)
388-
(insert "\
389-
<ilink: Button >
390-
<[Other]> <identity \"ARG\">
391-
")
396+
(insert "<ilink: Button3 >\n<[Other]> <identity 3>")
392397
(goto-char 4)
393398
(let ((err (should-error (ibtypes::ilink))))
394399
(should
395-
(string-match-p (rx "No button " (any punct) "Button" (any punct) " in")
400+
(string-match-p (rx "No button " (any punct) "Button3" (any punct) " in")
396401
(cadr err)))))
397402
(hy-delete-file-and-buffer file))))
398403

0 commit comments

Comments
 (0)