Skip to content

Commit da89554

Browse files
committed
Add ibtypes::ilink tests
* test/hibtypes-tests.el (ibtypes::ilink-ibut-in-other-file) (ibtypes::ilink-error-case-missing-button): Add tests.
1 parent 64d7daf commit da89554

2 files changed

Lines changed: 61 additions & 1 deletion

File tree

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2026-06-20 Mats Lidell <matsl@gnu.org>
2+
3+
* test/hibtypes-tests.el (ibtypes::ilink-ibut-in-other-file)
4+
(ibtypes::ilink-error-case-missing-button): Add tests.
5+
16
2026-06-18 Bob Weiner <rsw@gnu.org>
27

38
* hui-select.el (hui-select-get-syntax-table): Add and leave syntax-table

test/hibtypes-tests.el

Lines changed: 56 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: 18-Jun-26 at 12:04:02 by Bob Weiner
6+
;; Last-Mod: 20-Jun-26 at 11:06:02 by Mats Lidell
77
;;
88
;; SPDX-License-Identifier: GPL-3.0-or-later
99
;;
@@ -401,6 +401,61 @@
401401
(cadr err)))))
402402
(hy-delete-file-and-buffer file))))
403403

404+
(ert-deftest ibtypes::ilink-ibut-in-other-file ()
405+
"Verify link to ibut in other file."
406+
(let ((file (make-temp-file "ilink.txt")))
407+
(unwind-protect
408+
(progn
409+
(find-file file)
410+
(insert "<[Button]> <identity 1>")
411+
412+
(save-excursion
413+
(with-temp-buffer
414+
(insert (format "<ilink: Button:\"%s\">\n" file))
415+
(goto-char 4)
416+
(should (= 1 (ibtypes::ilink)))))
417+
418+
(insert "<[ABC]> <identity 2>")
419+
420+
(save-excursion
421+
(with-temp-buffer
422+
(insert (format "<ilink: ABC:\"%s\">\n" file))
423+
(goto-char 4)
424+
(should (= 2 (ibtypes::ilink)))))
425+
426+
(save-excursion
427+
(with-temp-buffer
428+
(insert (format "<ilink: XYZ:\"%s\">\n" file))
429+
(goto-char 4)
430+
(let ((err (should-error (ibtypes::ilink))))
431+
(should
432+
(string-match-p (rx "No button " (any punct) "XYZ" (any punct) " in")
433+
(cadr err)))))))
434+
435+
(hy-delete-file-and-buffer file))))
436+
437+
(ert-deftest ibtypes::ilink-error-case-missing-button ()
438+
"Check `ibtypes::ilink' errors when named button does not exist in `other-buffer'."
439+
:expected-result :failed
440+
;; FIXME: This is cept as a separate test case for showing the
441+
;; problem. When it is fixed the test can me merged in the working
442+
;; inlink tests.
443+
(let ((file (make-temp-file "ilink-test")))
444+
(unwind-protect
445+
(progn
446+
(find-file file)
447+
(insert "<[Button]> <identity 1234>\n")
448+
(with-temp-buffer
449+
(insert (format "<ilink: XYZ : \"%s\">\n" file))
450+
(goto-char 4)
451+
;; FIXME: This is what happens
452+
;; (should (= 1234 (ibtypes::ilink))))))
453+
(let ((err (should-error (ibtypes::ilink))))
454+
(should
455+
(string-match-p (rx "No button " (any punct) "XYZ" (any punct) " in")
456+
(cadr err))))))
457+
(hy-delete-file-and-buffer file))))
458+
404459
;; ipython-stack-frame
405460

406461
;; ripgrep-msg

0 commit comments

Comments
 (0)