Skip to content

Commit 39053a3

Browse files
authored
Merge pull request #932 from rswgnu/pr_add_hyrolo_bug_test
Add hyrolo test case for moving in fgrep result
2 parents f7dc406 + b0b71d6 commit 39053a3

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed

ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2026-04-08 Mats Lidell <matsl@gnu.org>
2+
3+
* test/hyrolo-tests.el (hyrolo-tests--fgrep-move-test): Add test case
4+
for moving in *HyRolo* buffer after fgrep search. Test is set as
5+
expected failed since there is a problem with moving over hidden
6+
sections.
7+
18
2026-04-05 Bob Weiner <rsw@gnu.org>
29

310
* hyrolo.el (hyrolo-hdr-to-first-line-p): Handle black lines and @loc> after

test/hyrolo-tests.el

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,84 @@ Match a string in the second cell."
459459
(kill-buffer hyrolo-display-buffer)
460460
(delete-directory folder))))
461461

462+
(ert-deftest hyrolo-tests--fgrep-move-test ()
463+
"Verify different move commands after `hyrolo-fgrep'."
464+
:expected-result :failed
465+
(let* ((kotl-file1 (hyrolo-tests--gen-kotl-outline "heading" "foo bar" 1))
466+
(kotl-file2 (hyrolo-tests--gen-kotl-outline "heading" "foo bar" 1))
467+
(hyrolo-file-list (list kotl-file1 kotl-file2))
468+
(h1_str " 1\\. heading")
469+
(h1a_str " 1a\\. heading 1"))
470+
(unwind-protect
471+
(progn
472+
(hyrolo-fgrep "bar")
473+
(should (string= hyrolo-display-buffer (buffer-name)))
474+
475+
(ert-info ("Move down using ?n")
476+
(should (looking-at-p "==="))
477+
(execute-kbd-macro (kbd "n"))
478+
(should (looking-at-p h1_str))
479+
(execute-kbd-macro (kbd "n"))
480+
(should (looking-at-p h1a_str))
481+
(execute-kbd-macro (kbd "n"))
482+
(should (looking-at-p "==="))
483+
(execute-kbd-macro (kbd "n"))
484+
(should (looking-at-p h1_str))
485+
(execute-kbd-macro (kbd "n"))
486+
(should (looking-at-p h1a_str))
487+
(execute-kbd-macro (kbd "n"))
488+
(should (eobp)))
489+
490+
(ert-info ("Move up using ?p")
491+
(execute-kbd-macro (kbd "p"))
492+
(should (looking-at-p h1a_str))
493+
(execute-kbd-macro (kbd "p"))
494+
(should (looking-at-p h1_str))
495+
(execute-kbd-macro (kbd "p"))
496+
(should (looking-at-p "==="))
497+
(execute-kbd-macro (kbd "p"))
498+
(should (looking-at-p h1a_str))
499+
(execute-kbd-macro (kbd "p"))
500+
(should (looking-at-p h1_str))
501+
(execute-kbd-macro (kbd "p"))
502+
(should (looking-at-p "==="))
503+
(should (bobp)))
504+
505+
(ert-info ("Move down using ?f")
506+
(should (looking-at-p "==="))
507+
(execute-kbd-macro (kbd "f"))
508+
(should (looking-at-p h1_str))
509+
(execute-kbd-macro (kbd "f"))
510+
(should (looking-at-p "==="))
511+
(execute-kbd-macro (kbd "f"))
512+
(should (looking-at-p h1_str))
513+
(should-error (execute-kbd-macro (kbd "f"))))
514+
515+
(ert-info ("Move up using ?b")
516+
(execute-kbd-macro (kbd "b"))
517+
(should (looking-at-p "==="))
518+
(execute-kbd-macro (kbd "b"))
519+
(should (looking-at-p h1_str))
520+
(execute-kbd-macro (kbd "b"))
521+
(should (looking-at-p "==="))
522+
(should-error (execute-kbd-macro (kbd "b")))
523+
(should (bobp)))
524+
525+
(ert-info ("Hide first header and move down using ?n")
526+
(should (looking-at-p "==="))
527+
(execute-kbd-macro (kbd "h"))
528+
(execute-kbd-macro (kbd "n"))
529+
(should (looking-at-p "==="))
530+
(execute-kbd-macro (kbd "n"))
531+
(should (looking-at-p h1_str))
532+
(execute-kbd-macro (kbd "n"))
533+
(should (looking-at-p h1a_str))
534+
(execute-kbd-macro (kbd "n"))
535+
(should (eobp))))
536+
;; Unwind forms
537+
(kill-buffer hyrolo-display-buffer)
538+
(hy-delete-files-and-buffers hyrolo-file-list))))
539+
462540
(ert-deftest hyrolo-tests--get-file-list-change ()
463541
"Verify a change to hyrolo-file-list is noticed by hyrolo-get-file-list."
464542
(let* ((tmp-file (make-temp-file "hypb" nil ".org"))

0 commit comments

Comments
 (0)