|
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 12:04:02 by Bob Weiner |
| 6 | +;; Last-Mod: 20-Jun-26 at 11:06:02 by Mats Lidell |
7 | 7 | ;; |
8 | 8 | ;; SPDX-License-Identifier: GPL-3.0-or-later |
9 | 9 | ;; |
|
401 | 401 | (cadr err))))) |
402 | 402 | (hy-delete-file-and-buffer file)))) |
403 | 403 |
|
| 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 | + |
404 | 459 | ;; ipython-stack-frame |
405 | 460 |
|
406 | 461 | ;; ripgrep-msg |
|
0 commit comments