|
3 | 3 | ;; Author: Mats Lidell <matsl@gnu.org> |
4 | 4 | ;; |
5 | 5 | ;; 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 |
7 | 7 | ;; |
8 | 8 | ;; SPDX-License-Identifier: GPL-3.0-or-later |
9 | 9 | ;; |
|
373 | 373 | ;; ilink |
374 | 374 | (ert-deftest ibtypes::ilink-test () |
375 | 375 | "Verify link to ibut in same buffer." |
376 | | - (let ((file (make-temp-file "ilink"))) |
| 376 | + (let ((file (make-temp-file "ilink-test"))) |
377 | 377 | (unwind-protect |
378 | 378 | (progn |
379 | 379 | (find-file file) |
380 | | - (insert "\ |
381 | | -<ilink: Button > |
382 | | -<[Button]> <identity \"ARG\"> |
383 | | -") |
| 380 | + (insert "<ilink: Button1 >\n<[Button1]> <identity 1>") |
384 | 381 | (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)))) |
386 | 394 |
|
387 | 395 | (erase-buffer) |
388 | | - (insert "\ |
389 | | -<ilink: Button > |
390 | | -<[Other]> <identity \"ARG\"> |
391 | | -") |
| 396 | + (insert "<ilink: Button3 >\n<[Other]> <identity 3>") |
392 | 397 | (goto-char 4) |
393 | 398 | (let ((err (should-error (ibtypes::ilink)))) |
394 | 399 | (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") |
396 | 401 | (cadr err))))) |
397 | 402 | (hy-delete-file-and-buffer file)))) |
398 | 403 |
|
@@ -565,36 +570,6 @@ file.el:10:20: Warning: Message |
565 | 570 | (should (ibtypes::org-id)))) |
566 | 571 | (hy-delete-file-and-buffer file)))) |
567 | 572 |
|
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 | | - |
598 | 573 | ;; This file can't be byte-compiled without the `el-mock' package (because of |
599 | 574 | ;; the use of the `with-mock' macro), which is not a dependency of Hyperbole. |
600 | 575 | ;; Local Variables: |
|
0 commit comments