Skip to content

Commit 69c261c

Browse files
committed
ibtypes::ilink-test - Ensure only one instance of this test
1 parent 7ef5a18 commit 69c261c

2 files changed

Lines changed: 19 additions & 43 deletions

File tree

ChangeLog

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

3-
* test/hibtypes-tests.el (ibtypes::ilink-test): Add.
3+
* test/hibtypes-tests.el (ibtypes::ilink-test): Add and ensure only one
4+
instance of this test.
45

56
* hywiki.el (hywiki-include-special-modes): Add to recognize HyWikiWords in
67
particular special major modes, like eww and elfeed ones.

test/hibtypes-tests.el

Lines changed: 17 additions & 42 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: 18-Jun-26 at 11:52:57 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

@@ -565,36 +570,6 @@ file.el:10:20: Warning: Message
565570
(should (ibtypes::org-id))))
566571
(hy-delete-file-and-buffer file))))
567572

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-
598573
;; This file can't be byte-compiled without the `el-mock' package (because of
599574
;; the use of the `with-mock' macro), which is not a dependency of Hyperbole.
600575
;; Local Variables:

0 commit comments

Comments
 (0)