From c25095f5e076bb07b07514dddd2da81f6ab94f00 Mon Sep 17 00:00:00 2001 From: Mats Lidell Date: Fri, 10 Apr 2026 00:36:39 +0200 Subject: [PATCH] Add more hyrolo movement tests * test/hyrolo-tests.el (hyrolo-tests--fgrep-move-test): Add more tests for movement when a section is hidden. --- ChangeLog | 5 +++++ test/hyrolo-tests.el | 32 +++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7a27cf08..97fe58ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2026-04-10 Mats Lidell + +* test/hyrolo-tests.el (hyrolo-tests--fgrep-move-test): Add more tests for + movement when a section is hidden. + 2026-04-08 Bob Weiner * test/hyrolo-tests.el (hyrolo-tests--fgrep-move-test): Move tests more diff --git a/test/hyrolo-tests.el b/test/hyrolo-tests.el index 8a684f2c..a475b569 100644 --- a/test/hyrolo-tests.el +++ b/test/hyrolo-tests.el @@ -461,6 +461,7 @@ Match a string in the second cell." (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)) @@ -483,8 +484,37 @@ Match a string in the second cell." (execute-kbd-macro (kbd "n")) (should (eobp))) + (ert-info ("With hidden first header 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 "===")) + (should (bobp))) + + (ert-info ("With hidden first header move down using ?f") + (should (looking-at-p "===")) + (execute-kbd-macro (kbd "f")) + (should (looking-at-p "===")) + (execute-kbd-macro (kbd "f")) + (should (looking-at-p h1_str)) + (let ((err (should-error (execute-kbd-macro (kbd "f"))))) + (should (string-match-p "No following same-level heading/header" (cadr err))))) + + (ert-info ("With hidden first header move up using ?b") + (execute-kbd-macro (kbd "b")) + (should (looking-at-p "===")) + (execute-kbd-macro (kbd "b")) + (should (looking-at-p "===")) + (should (bobp)) + (let ((err (should-error (execute-kbd-macro (kbd "b"))))) + (should-not (equal '(void-function nil) err)))) ;FIXME: No error message but void-function!? + (outline-show-all) - (goto-char (point-min)) + (ert-info ("Move down using ?n") (should (looking-at-p "===")) (execute-kbd-macro (kbd "n"))