Skip to content

Commit

Permalink
Verify hyrolo match count
Browse files Browse the repository at this point in the history
  • Loading branch information
matsl committed Mar 30, 2024
1 parent e009e24 commit ebad0d7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2024-03-30 Mats Lidell <matsl@gnu.org>

* test/hyrolo-tests.el (hyrolo-test--grep-count): Verify hyrolo match count.

2024-03-30 Bob Weiner <rsw@gnu.org>

* hyrolo.el (hyrolo-highlight-matches): Limit search to within 'end' bound.
Expand Down
18 changes: 17 additions & 1 deletion test/hyrolo-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Mats Lidell <matsl@gnu.org>
;;
;; Orig-Date: 19-Jun-21 at 22:42:00
;; Last-Mod: 22-Mar-24 at 08:37:53 by Bob Weiner
;; Last-Mod: 30-Mar-24 at 23:35:15 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -1634,6 +1634,22 @@ body
(kill-buffer hyrolo-display-buffer)
(hy-delete-files-and-buffers hyrolo-file-list))))

(ert-deftest hyrolo-test--grep-count ()
"Verify number of matches are correct."
:expected-result :failed
(unwind-protect
(with-temp-buffer
(org-mode)
(insert "\
* match
match
* other
match
")
(should (= (hyrolo-grep "match" nil (current-buffer) t nil) 3))
(should (= (hyrolo-grep "match" nil (current-buffer) t t) 1)))
(kill-buffer hyrolo-display-buffer)))

(provide 'hyrolo-tests)

;; This file can't be byte-compiled without the `el-mock' package
Expand Down

0 comments on commit ebad0d7

Please sign in to comment.