|
3 | 3 | ;; Author: Mats Lidell <matsl@gnu.org> |
4 | 4 | ;; |
5 | 5 | ;; Orig-Date: 19-Jun-21 at 22:42:00 |
6 | | -;; Last-Mod: 16-Aug-25 at 15:30:03 by Bob Weiner |
| 6 | +;; Last-Mod: 14-Mar-26 at 19:44:08 by Mats Lidell |
7 | 7 | ;; |
8 | 8 | ;; SPDX-License-Identifier: GPL-3.0-or-later |
9 | 9 | ;; |
10 | | -;; Copyright (C) 2021-2025 Free Software Foundation, Inc. |
| 10 | +;; Copyright (C) 2021-2026 Free Software Foundation, Inc. |
11 | 11 | ;; See the "HY-COPY" file for license information. |
12 | 12 | ;; |
13 | 13 | ;; This file is part of GNU Hyperbole. |
@@ -1696,6 +1696,30 @@ match |
1696 | 1696 | (let ((buffer-file-name "file")) |
1697 | 1697 | (should (hyrolo-at-tags-p t)))))) |
1698 | 1698 |
|
| 1699 | +(ert-deftest hyrolo-tests--display-matches () |
| 1700 | + "Verify hyrolo-display-matches displays the buffer with the matches." |
| 1701 | + (ert-info ("No previous search nor buffer is provided") |
| 1702 | + (with-mock |
| 1703 | + (mock (get-buffer hyrolo-display-buffer) => nil) |
| 1704 | + (should-error (hyrolo-display-matches nil)))) |
| 1705 | + (with-temp-buffer |
| 1706 | + (let ((buf1 (current-buffer))) |
| 1707 | + (with-temp-buffer |
| 1708 | + (let ((buf2 (current-buffer)) |
| 1709 | + hyrolo--wconfig |
| 1710 | + (display-buffer-alist '((".*" display-buffer-same-window)))) |
| 1711 | + (ert-info ("Provided buffer is selected with window config") |
| 1712 | + (hyrolo-display-matches buf1) |
| 1713 | + (should hyrolo--wconfig) |
| 1714 | + (should (equal buf1 (current-buffer)))) |
| 1715 | + (ert-info ("Provided buffer already visible, don't save window config") |
| 1716 | + (setq hyrolo--wconfig nil) |
| 1717 | + (hyrolo-display-matches buf1) |
| 1718 | + (should-not hyrolo--wconfig)) |
| 1719 | + (ert-info ("return-to-buffer is selected") |
| 1720 | + (hyrolo-display-matches buf1 buf2) |
| 1721 | + (should (equal buf2 (current-buffer))))))))) |
| 1722 | + |
1699 | 1723 | (provide 'hyrolo-tests) |
1700 | 1724 |
|
1701 | 1725 | ;; This file can't be byte-compiled without the `el-mock' package |
|
0 commit comments