branch: externals/hyperbole
commit e995fc8905371e20dd9f739feb86b1e6af5f0fd8
Author: Mats Lidell <[email protected]>
Commit: Mats Lidell <[email protected]>
Add test for moving between two sections
---
ChangeLog | 5 +++--
test/hyrolo-tests.el | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 51 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 192412611a..0f02762c89 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,8 +6,9 @@
tests.
(hyrolo-tests--outline-next-visible-header)
(hyrolo-tests--tab-through-matches)
- (hyrolo-tests--outline-hide-show-heading): Add test for working with hyrolo
- matches.
+ (hyrolo-tests--outline-hide-show-heading)
+ (hyrolo-tests--outline-next-visible-header-two-sections): Add test for
+ working with hyrolo matches.
2023-12-31 Mats Lidell <[email protected]>
diff --git a/test/hyrolo-tests.el b/test/hyrolo-tests.el
index 75690a57ce..7cb7f8bf33 100644
--- a/test/hyrolo-tests.el
+++ b/test/hyrolo-tests.el
@@ -3,7 +3,7 @@
;; Author: Mats Lidell <[email protected]>
;;
;; Orig-Date: 19-Jun-21 at 22:42:00
-;; Last-Mod: 1-Jan-24 at 19:18:41 by Mats Lidell
+;; Last-Mod: 1-Jan-24 at 19:29:48 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -566,6 +566,53 @@ Example:
(kill-buffer "*HyRolo*")
(hy-delete-file-and-buffer org-file))))
+(ert-deftest hyrolo-tests--outline-next-visible-header-two-sections ()
+ "Verify movement to next visible header with two sections."
+ (let* ((org-file1 (make-temp-file "hypb" nil ".org"
+ (hyrolo-tests--gen-outline "header-a" 1
"body-a" 2)))
+ (org-file2 (make-temp-file "hypb" nil ".org"
+ (hyrolo-tests--gen-outline "header-b" 1
"body-b" 2)))
+ (hyrolo-file-list (list org-file1 org-file2)))
+ (unwind-protect
+ (progn
+ (hyrolo-grep "body")
+ (should (string= "*HyRolo*" (buffer-name)))
+
+ ;; Move down
+ (should (looking-at-p "==="))
+ (should (hact 'kbd-key "n"))
+ (should (looking-at-p "^* header-a 1$"))
+ (should (hact 'kbd-key "n"))
+ (should (looking-at-p "^** header-a 1.2$"))
+ (should (hact 'kbd-key "n"))
+ (should (looking-at-p "^* header-b 1$"))
+ (should (hact 'kbd-key "n"))
+ (should (looking-at-p "^** header-b 1.2$"))
+ (should (hact 'kbd-key "n"))
+ (should (eobp))
+
+ ;; Move back up
+ (should (hact 'kbd-key "p"))
+ (should (looking-at-p "^** header-b 1.2$"))
+ (should (hact 'kbd-key "p"))
+ (should (looking-at-p "^* header-b 1$"))
+ (should (hact 'kbd-key "p"))
+ (should (looking-at-p "^** header-a 1.2$"))
+ (should (hact 'kbd-key "p"))
+ (should (looking-at-p "^* header-a 1$"))
+ (should (hact 'kbd-key "p"))
+
+ ;; BUG: This fails in Emacs 29 and 30
+ ;; This is the expected behavior that works in Emacs 27 and 28.
+ ;; (should (looking-at-p "==="))
+ ;; (should (bobp))
+ ;; This is what we get
+ (should (looking-at-p "@loc>"))
+ (should (= 2 (line-number-at-pos))))
+ (kill-buffer "*HyRolo*")
+ (hy-delete-file-and-buffer org-file1)
+ (hy-delete-file-and-buffer org-file2))))
+
(ert-deftest hyrolo-tests--outline-hide-show-heading ()
"Verify hiding and showing headers."
(let* ((org-file (make-temp-file "hypb" nil ".org"