From da89554be41eb1f6ece2a655f4f834dca20b126e Mon Sep 17 00:00:00 2001 From: Mats Lidell Date: Tue, 16 Jun 2026 19:58:39 +0200 Subject: [PATCH 1/3] Add ibtypes::ilink tests * test/hibtypes-tests.el (ibtypes::ilink-ibut-in-other-file) (ibtypes::ilink-error-case-missing-button): Add tests. --- ChangeLog | 5 ++++ test/hibtypes-tests.el | 57 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7682a637..2f18370d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2026-06-20 Mats Lidell + +* test/hibtypes-tests.el (ibtypes::ilink-ibut-in-other-file) + (ibtypes::ilink-error-case-missing-button): Add tests. + 2026-06-18 Bob Weiner * hui-select.el (hui-select-get-syntax-table): Add and leave syntax-table diff --git a/test/hibtypes-tests.el b/test/hibtypes-tests.el index 8db88269..7fa36be3 100644 --- a/test/hibtypes-tests.el +++ b/test/hibtypes-tests.el @@ -3,7 +3,7 @@ ;; Author: Mats Lidell ;; ;; 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:06:02 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -401,6 +401,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]> ") + + (save-excursion + (with-temp-buffer + (insert (format "\n" file)) + (goto-char 4) + (should (= 1 (ibtypes::ilink))))) + + (insert "<[ABC]> ") + + (save-excursion + (with-temp-buffer + (insert (format "\n" file)) + (goto-char 4) + (should (= 2 (ibtypes::ilink))))) + + (save-excursion + (with-temp-buffer + (insert (format "\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 + ;; 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]> \n") + (with-temp-buffer + (insert (format "\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 From cfc8fc5cd54a7d301b1f68b6b4c86e1316f5a90b Mon Sep 17 00:00:00 2001 From: Mats Lidell Date: Sat, 20 Jun 2026 11:15:55 +0200 Subject: [PATCH 2/3] Add ibtypes::elink test for ebut in other file * test/hibtypes-tests.el (ibtypes::elink-ebut-in-other-file): Add test. --- ChangeLog | 3 ++- test/hibtypes-tests.el | 25 ++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2f18370d..ca5f41f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,8 @@ 2026-06-20 Mats Lidell * test/hibtypes-tests.el (ibtypes::ilink-ibut-in-other-file) - (ibtypes::ilink-error-case-missing-button): Add tests. + (ibtypes::ilink-error-case-missing-button) + (ibtypes::elink-ebut-in-other-file): Add tests. 2026-06-18 Bob Weiner diff --git a/test/hibtypes-tests.el b/test/hibtypes-tests.el index 7fa36be3..9cb6d632 100644 --- a/test/hibtypes-tests.el +++ b/test/hibtypes-tests.el @@ -3,7 +3,7 @@ ;; Author: Mats Lidell ;; ;; Orig-Date: 20-Feb-21 at 23:45:00 -;; Last-Mod: 20-Jun-26 at 11:06:02 by Mats Lidell +;; Last-Mod: 20-Jun-26 at 11:14:35 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -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 "\n" file)) + (goto-char 4) + (should (string= "EBUT" (ibtypes::elink))) + + (goto-char (point-min)) + (insert (format "\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." From ddc2dd3b3425ceb95a52633e5272400449e971cd Mon Sep 17 00:00:00 2001 From: Mats Lidell Date: Sat, 20 Jun 2026 23:08:26 +0200 Subject: [PATCH 3/3] Fix spelling --- test/hibtypes-tests.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/hibtypes-tests.el b/test/hibtypes-tests.el index 9cb6d632..9c3f3326 100644 --- a/test/hibtypes-tests.el +++ b/test/hibtypes-tests.el @@ -3,7 +3,7 @@ ;; Author: Mats Lidell ;; ;; Orig-Date: 20-Feb-21 at 23:45:00 -;; Last-Mod: 20-Jun-26 at 11:14:35 by Mats Lidell +;; Last-Mod: 20-Jun-26 at 23:08:13 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -460,9 +460,9 @@ (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 - ;; problem. When it is fixed the test can me merged in the working - ;; inlink tests. + ;; FIXME: This is kept as a separate test case for showing the + ;; problem. When it is fixed the test can me merged with the working + ;; inlink test. (let ((file (make-temp-file "ilink-test"))) (unwind-protect (progn