|
3 | 3 | ;; Author: Mats Lidell <matsl@gnu.org> |
4 | 4 | ;; |
5 | 5 | ;; 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 11:52:57 by Bob Weiner |
7 | 7 | ;; |
8 | 8 | ;; SPDX-License-Identifier: GPL-3.0-or-later |
9 | 9 | ;; |
@@ -565,6 +565,36 @@ file.el:10:20: Warning: Message |
565 | 565 | (should (ibtypes::org-id)))) |
566 | 566 | (hy-delete-file-and-buffer file)))) |
567 | 567 |
|
| 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 | + |
568 | 598 | ;; This file can't be byte-compiled without the `el-mock' package (because of |
569 | 599 | ;; the use of the `with-mock' macro), which is not a dependency of Hyperbole. |
570 | 600 | ;; Local Variables: |
|
0 commit comments