Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2026-06-20 Mats Lidell <matsl@gnu.org>

* test/hibtypes-tests.el (ibtypes::ilink-ibut-in-other-file)
(ibtypes::ilink-error-case-missing-button)
(ibtypes::elink-ebut-in-other-file): Add tests.

2026-06-18 Bob Weiner <rsw@gnu.org>

* hui-select.el (hui-select-get-syntax-table): Add and leave syntax-table
Expand Down
80 changes: 79 additions & 1 deletion test/hibtypes-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Mats Lidell <matsl@gnu.org>
;;
;; Orig-Date: 20-Feb-21 at 23:45:00
;; Last-Mod: 18-Jun-26 at 12:04:02 by Bob Weiner
;; Last-Mod: 20-Jun-26 at 11:14:35 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -346,6 +346,29 @@
(cadr err)))))
(hy-delete-files-and-buffers (list file)))))

(ert-deftest ibtypes::elink-ebut-in-other-file ()
"Verify link to ebut in other file."
(let ((file (make-temp-file "elink")))
(unwind-protect
(progn
(find-file file)
(ebut:program "Button" 'eval-elisp '(message "EBUT"))

(save-excursion
(with-temp-buffer
(insert (format "<elink: Button:\"%s\">\n" file))
(goto-char 4)
(should (string= "EBUT" (ibtypes::elink)))

(goto-char (point-min))
(insert (format "<elink: Other:\"%s\">\n" file))
(goto-char 4)
(let ((err (should-error (ibtypes::elink))))
(should
(string-match-p (rx "No button " (any punct) "Other" (any punct))
(cadr err)))))))
(hy-delete-files-and-buffers (list file)))))

;; glink
(ert-deftest ibtypes::glink-test ()
"Verify link to global button."
Expand Down Expand Up @@ -401,6 +424,61 @@
(cadr err)))))
(hy-delete-file-and-buffer file))))

(ert-deftest ibtypes::ilink-ibut-in-other-file ()
"Verify link to ibut in other file."
(let ((file (make-temp-file "ilink.txt")))
(unwind-protect
(progn
(find-file file)
(insert "<[Button]> <identity 1>")

(save-excursion
(with-temp-buffer
(insert (format "<ilink: Button:\"%s\">\n" file))
(goto-char 4)
(should (= 1 (ibtypes::ilink)))))

(insert "<[ABC]> <identity 2>")

(save-excursion
(with-temp-buffer
(insert (format "<ilink: ABC:\"%s\">\n" file))
(goto-char 4)
(should (= 2 (ibtypes::ilink)))))

(save-excursion
(with-temp-buffer
(insert (format "<ilink: XYZ:\"%s\">\n" file))
(goto-char 4)
(let ((err (should-error (ibtypes::ilink))))
(should
(string-match-p (rx "No button " (any punct) "XYZ" (any punct) " in")
(cadr err)))))))

(hy-delete-file-and-buffer file))))

(ert-deftest ibtypes::ilink-error-case-missing-button ()
"Check `ibtypes::ilink' errors when named button does not exist in `other-buffer'."
:expected-result :failed
;; FIXME: This is cept as a separate test case for showing the

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 typos in this sentence.

;; problem. When it is fixed the test can me merged in the working
;; inlink tests.
(let ((file (make-temp-file "ilink-test")))
(unwind-protect
(progn
(find-file file)
(insert "<[Button]> <identity 1234>\n")
(with-temp-buffer
(insert (format "<ilink: XYZ : \"%s\">\n" file))
(goto-char 4)
;; FIXME: This is what happens
;; (should (= 1234 (ibtypes::ilink))))))
(let ((err (should-error (ibtypes::ilink))))
(should
(string-match-p (rx "No button " (any punct) "XYZ" (any punct) " in")
(cadr err))))))
(hy-delete-file-and-buffer file))))

;; ipython-stack-frame

;; ripgrep-msg
Expand Down