branch: externals/hyperbole
commit 9c25ca128a94efb81e0a6ed24d123a0d78dc5bea
Author: Mats Lidell <[email protected]>
Commit: Mats Lidell <[email protected]>
Add test for moving up from sub header
---
ChangeLog | 1 +
test/hyrolo-tests.el | 24 +++++++++++++++++++++++-
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 0f02762c89..50eddf1d3d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@
(hyrolo-tests--outline-next-visible-header)
(hyrolo-tests--tab-through-matches)
(hyrolo-tests--outline-hide-show-heading)
+ (hyrolo-tests--outline-up-header)
(hyrolo-tests--outline-next-visible-header-two-sections): Add test for
working with hyrolo matches.
diff --git a/test/hyrolo-tests.el b/test/hyrolo-tests.el
index 7cb7f8bf33..5e714c5b1f 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:29:48 by Mats Lidell
+;; Last-Mod: 1-Jan-24 at 20:56:49 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -566,6 +566,28 @@ Example:
(kill-buffer "*HyRolo*")
(hy-delete-file-and-buffer org-file))))
+(ert-deftest hyrolo-tests--outline-up-header ()
+ "Verify movement from sub header to next header one level above."
+ (let* ((org-file (make-temp-file "hypb" nil ".org"
+ (hyrolo-tests--gen-outline "header" 2
"body" 3)))
+ (hyrolo-file-list (list org-file)))
+ (unwind-protect
+ (progn
+ (hyrolo-grep "body")
+ (should (string= "*HyRolo*" (buffer-name)))
+
+ ;; Move to last header
+ (goto-char (point-max))
+ (forward-line -2)
+ (should (looking-at-p "^*** header 2.2.3$"))
+ (should (hact 'kbd-key "u"))
+ (should (looking-at-p "^** header 2.2$"))
+ (should (hact 'kbd-key "u"))
+ (should (looking-at-p "^* header 2$"))
+ (should-error (hact 'kbd-key "u")))
+ (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"