Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2026-04-08 Mats Lidell <matsl@gnu.org>

* test/hyrolo-tests.el (hyrolo-tests--fgrep-move-test): Add test case
for moving in *HyRolo* buffer after fgrep search. Test is set as
expected failed since there is a problem with moving over hidden
sections.

2026-04-05 Bob Weiner <rsw@gnu.org>

* hyrolo.el (hyrolo-hdr-to-first-line-p): Handle black lines and @loc> after
Expand Down
78 changes: 78 additions & 0 deletions test/hyrolo-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,84 @@ Match a string in the second cell."
(kill-buffer hyrolo-display-buffer)
(delete-directory folder))))

(ert-deftest hyrolo-tests--fgrep-move-test ()
"Verify different move commands after `hyrolo-fgrep'."
:expected-result :failed
(let* ((kotl-file1 (hyrolo-tests--gen-kotl-outline "heading" "foo bar" 1))
(kotl-file2 (hyrolo-tests--gen-kotl-outline "heading" "foo bar" 1))
(hyrolo-file-list (list kotl-file1 kotl-file2))
(h1_str " 1\\. heading")
(h1a_str " 1a\\. heading 1"))
(unwind-protect
(progn
(hyrolo-fgrep "bar")
(should (string= hyrolo-display-buffer (buffer-name)))

(ert-info ("Move down using ?n")
(should (looking-at-p "==="))
(execute-kbd-macro (kbd "n"))
(should (looking-at-p h1_str))
(execute-kbd-macro (kbd "n"))
(should (looking-at-p h1a_str))
(execute-kbd-macro (kbd "n"))
(should (looking-at-p "==="))
(execute-kbd-macro (kbd "n"))
(should (looking-at-p h1_str))
(execute-kbd-macro (kbd "n"))
(should (looking-at-p h1a_str))
(execute-kbd-macro (kbd "n"))
(should (eobp)))

(ert-info ("Move up using ?p")
(execute-kbd-macro (kbd "p"))
(should (looking-at-p h1a_str))
(execute-kbd-macro (kbd "p"))
(should (looking-at-p h1_str))
(execute-kbd-macro (kbd "p"))
(should (looking-at-p "==="))
(execute-kbd-macro (kbd "p"))
(should (looking-at-p h1a_str))
(execute-kbd-macro (kbd "p"))
(should (looking-at-p h1_str))
(execute-kbd-macro (kbd "p"))
(should (looking-at-p "==="))
(should (bobp)))

(ert-info ("Move down using ?f")
(should (looking-at-p "==="))
(execute-kbd-macro (kbd "f"))
(should (looking-at-p h1_str))
(execute-kbd-macro (kbd "f"))
(should (looking-at-p "==="))
(execute-kbd-macro (kbd "f"))
(should (looking-at-p h1_str))
(should-error (execute-kbd-macro (kbd "f"))))

(ert-info ("Move up using ?b")
(execute-kbd-macro (kbd "b"))
(should (looking-at-p "==="))
(execute-kbd-macro (kbd "b"))
(should (looking-at-p h1_str))
(execute-kbd-macro (kbd "b"))
(should (looking-at-p "==="))
(should-error (execute-kbd-macro (kbd "b")))
(should (bobp)))

(ert-info ("Hide first header and move down using ?n")
(should (looking-at-p "==="))
(execute-kbd-macro (kbd "h"))
(execute-kbd-macro (kbd "n"))
(should (looking-at-p "==="))
(execute-kbd-macro (kbd "n"))
(should (looking-at-p h1_str))
(execute-kbd-macro (kbd "n"))
(should (looking-at-p h1a_str))
(execute-kbd-macro (kbd "n"))
(should (eobp))))
;; Unwind forms
(kill-buffer hyrolo-display-buffer)
(hy-delete-files-and-buffers hyrolo-file-list))))

(ert-deftest hyrolo-tests--get-file-list-change ()
"Verify a change to hyrolo-file-list is noticed by hyrolo-get-file-list."
(let* ((tmp-file (make-temp-file "hypb" nil ".org"))
Expand Down