[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole eeb6aacd9f 075/143: Add more hyrolo show, hi
From: |
ELPA Syncer |
Subject: |
[elpa] externals/hyperbole eeb6aacd9f 075/143: Add more hyrolo show, hide and movement tests (#436) |
Date: |
Mon, 19 Feb 2024 15:59:05 -0500 (EST) |
branch: externals/hyperbole
commit eeb6aacd9f152dbc219e94db41fe962ad03bf6ca
Author: Mats Lidell <mats.lidell@lidells.se>
Commit: GitHub <noreply@github.com>
Add more hyrolo show, hide and movement tests (#436)
Tests depending on fold behavior in org mode have been skipped for org
mode later or equal to 9.6. This is so that all Emacs versions will
pass the CI/CD build. When this BUG is fixed in hyrolo these guards
can be removed.
---
ChangeLog | 15 ++++
test/hy-test-helpers.el | 7 +-
test/hyrolo-tests.el | 221 +++++++++++++++++++++++++++++++++++++++++++-----
3 files changed, 221 insertions(+), 22 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3b89bba8ea..8003328c99 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-01-09 Mats Lidell <matsl@gnu.org>
+
+* test/hyrolo-tests.el (hyrolo-tests--outline-next-visible-heading-md)
+ (hyrolo-tests--outline-next-visible-heading-all)
+ (hyrolo-tests--outline-next-visible-heading-kotl)
+ (hyrolo-tests--outline-next-visible-heading-all-file-types)
+ (hyrolo-tests--outline-show-when-moving-out-of-hidden-line): Add more
+ test cases for hyrolo outline show, hide and movement.
+
+ (hyrolo-tests--gen-kotl-outline, hyrolo-tests--verify-hidden-line)
+ (hyrolo-tests--verify-not-hidden-line): Add helper functions and use.
+
2024-01-09 Bob Weiner <rsw@gnu.org>
* hact.el (htype:def-symbol, htype:names, actype:def-symbol): Change call
@@ -21,6 +33,9 @@
hsys-xref.el (hsys-xref-definitions): Move xref utility functions
from "hmouse-tag.el" to here and add Hyperbole unique hsys- prefix.
+* test/hy-test-helpers.el (hy-delete-files-and-buffers): Add helper for
+ cleaning up multiple files and buffers.
+
2024-01-06 Mats Lidell <matsl@gnu.org>
* Makefile (HYPB_ERT_BATCH, HYPB_ERT_BATCH_BT): Add command line arg to
diff --git a/test/hy-test-helpers.el b/test/hy-test-helpers.el
index 9d920e96cf..80bd4814f3 100644
--- a/test/hy-test-helpers.el
+++ b/test/hy-test-helpers.el
@@ -3,7 +3,7 @@
;; Author: Mats Lidell <matsl@gnu.org>
;;
;; Orig-Date: 30-Jan-21 at 12:00:00
-;; Last-Mod: 26-Dec-23 at 11:55:42 by Bob Weiner
+;; Last-Mod: 7-Jan-24 at 00:56:08 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -88,6 +88,11 @@ Checks ACTYPE, ARGS, LOC and LBL-KEY."
(kill-buffer))))
(delete-file file))
+(defun hy-delete-files-and-buffers (files)
+ "Delete all FILES and all buffers visiting those files."
+ (dolist (f files)
+ (hy-delete-file-and-buffer f)))
+
(defun hy-delete-dir-and-buffer (dir)
"Delete DIR and buffer visiting directory."
(let ((buf (find-buffer-visiting dir)))
diff --git a/test/hyrolo-tests.el b/test/hyrolo-tests.el
index 8c1d8f57da..e033a471da 100644
--- a/test/hyrolo-tests.el
+++ b/test/hyrolo-tests.el
@@ -3,7 +3,7 @@
;; Author: Mats Lidell <matsl@gnu.org>
;;
;; Orig-Date: 19-Jun-21 at 22:42:00
-;; Last-Mod: 6-Jan-24 at 12:42:21 by Mats Lidell
+;; Last-Mod: 7-Jan-24 at 01:00:43 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -559,7 +559,83 @@ Example:
(should (looking-at-p "==="))
(should (bobp)))
(kill-buffer hyrolo-display-buffer)
- (hy-delete-file-and-buffer org-file))))
+ (hy-delete-files-and-buffers hyrolo-file-list))))
+
+(ert-deftest hyrolo-tests--outline-next-visible-heading-md ()
+ "Verify movement to next visible heading."
+ (let* ((md-file (make-temp-file "hypb" nil ".md"
+ (hyrolo-tests--gen-outline ?# "heading" 2
"body" 2)))
+ (hyrolo-file-list (list md-file)))
+ (unwind-protect
+ (progn
+ (hyrolo-grep "body")
+ (should (string= hyrolo-display-buffer (buffer-name)))
+
+ ;; Move down
+ (should (looking-at-p "==="))
+ (should (hact 'kbd-key "n"))
+ (should (looking-at-p "^# heading 1"))
+ (should (hact 'kbd-key "n"))
+ (should (looking-at-p "^## heading 1\\.2"))
+ (should (hact 'kbd-key "n"))
+ (should (looking-at-p "^# heading 2"))
+ (should (hact 'kbd-key "n"))
+ (should (looking-at-p "^## heading 2\\.2"))
+ (should (hact 'kbd-key "n"))
+ (should (eobp))
+
+ ;; Move back up
+ (should (hact 'kbd-key "p"))
+ (should (looking-at-p "^## heading 2\\.2"))
+ (should (hact 'kbd-key "p"))
+ (should (looking-at-p "^# heading 2"))
+ (should (hact 'kbd-key "p"))
+ (should (looking-at-p "^## heading 1\\.2"))
+ (should (hact 'kbd-key "p"))
+ (should (looking-at-p "^# heading 1"))
+ (should (hact 'kbd-key "p"))
+ (should (looking-at-p "==="))
+ (should (bobp)))
+ (kill-buffer hyrolo-display-buffer)
+ (hy-delete-files-and-buffers hyrolo-file-list))))
+
+(ert-deftest hyrolo-tests--outline-next-visible-heading-all ()
+ "Verify movement to next visible heading."
+ (let* ((md-file (make-temp-file "hypb" nil ".md"
+ (hyrolo-tests--gen-outline ?# "heading" 2
"body" 2)))
+ (hyrolo-file-list (list md-file)))
+ (unwind-protect
+ (progn
+ (hyrolo-grep "body")
+ (should (string= hyrolo-display-buffer (buffer-name)))
+
+ ;; Move down
+ (should (looking-at-p "==="))
+ (should (hact 'kbd-key "n"))
+ (should (looking-at-p "^# heading 1"))
+ (should (hact 'kbd-key "n"))
+ (should (looking-at-p "^## heading 1\\.2"))
+ (should (hact 'kbd-key "n"))
+ (should (looking-at-p "^# heading 2"))
+ (should (hact 'kbd-key "n"))
+ (should (looking-at-p "^## heading 2\\.2"))
+ (should (hact 'kbd-key "n"))
+ (should (eobp))
+
+ ;; Move back up
+ (should (hact 'kbd-key "p"))
+ (should (looking-at-p "^## heading 2\\.2"))
+ (should (hact 'kbd-key "p"))
+ (should (looking-at-p "^# heading 2"))
+ (should (hact 'kbd-key "p"))
+ (should (looking-at-p "^## heading 1\\.2"))
+ (should (hact 'kbd-key "p"))
+ (should (looking-at-p "^# heading 1"))
+ (should (hact 'kbd-key "p"))
+ (should (looking-at-p "==="))
+ (should (bobp)))
+ (kill-buffer hyrolo-display-buffer)
+ (hy-delete-files-and-buffers hyrolo-file-list))))
(ert-deftest hyrolo-tests--outline-up-heading ()
"Verify movement from sub heading to next heading one level above."
@@ -623,41 +699,144 @@ Example:
(should (looking-at-p "==="))
(should (= 1 (line-number-at-pos))))
(kill-buffer hyrolo-display-buffer)
- (hy-delete-file-and-buffer org-file1)
- (hy-delete-file-and-buffer md-file1))))
+ (hy-delete-files-and-buffers hyrolo-file-list))))
+
+(defun hyrolo-tests--gen-kotl-outline (heading body)
+ "Generate a temp file with kotl outline structure for hyrolo outline test.
+Make cell start with HEADING and follow by next line BODY."
+ (let ((kotl-file (make-temp-file "hypb" nil ".kotl")))
+ (find-file kotl-file)
+ (insert heading)
+ (kotl-mode:newline 1)
+ (insert body)
+ (kotl-mode:newline 1)
+ (save-buffer)
+ kotl-file))
+
+(ert-deftest hyrolo-tests--outline-next-visible-heading-kotl ()
+ "Verify movement to next visible heading with a kotl file."
+ (let* ((kotl-file1 (hyrolo-tests--gen-kotl-outline "heading-kotl"
"body-kotl"))
+ (hyrolo-file-list (list kotl-file1)))
+ (unwind-protect
+ (progn
+ (hyrolo-grep "body")
+ (should (string= hyrolo-display-buffer (buffer-name)))
+
+ (should (looking-at-p "==="))
+ (should (and (hact 'kbd-key "n") (looking-at-p "^ +1\\.
heading-kotl$")))
+ (should (and (hact 'kbd-key "n") (eobp)))
+ (should (and (hact 'kbd-key "p") (looking-at-p "^ +1\\.
heading-kotl$")))
+ (should (and (hact 'kbd-key "p") (looking-at-p "==="))))
+ (kill-buffer hyrolo-display-buffer)
+ (hy-delete-files-and-buffers hyrolo-file-list))))
+
+(ert-deftest hyrolo-tests--outline-next-visible-heading-all-file-types ()
+ "Verify movement to next visible heading with all files types present."
+ (let* ((org-file1 (make-temp-file "hypb" nil ".org"
+ (hyrolo-tests--gen-outline ?*
"heading-org" 1 "body-org" 1)))
+ (otl-file1 (make-temp-file "hypb" nil ".otl"
+ (hyrolo-tests--gen-outline ?*
"heading-otl" 1 "body-otl" 1)))
+ (md-file1 (make-temp-file "hypb" nil ".md"
+ (hyrolo-tests--gen-outline ?# "heading-md"
1 "body-md" 1)))
+ (kotl-file1 (hyrolo-tests--gen-kotl-outline "heading-kotl"
"body-kotl"))
+ (hyrolo-file-list (list org-file1 otl-file1 md-file1 kotl-file1)))
+ (unwind-protect
+ (progn
+ (hyrolo-grep "body")
+ (should (string= hyrolo-display-buffer (buffer-name)))
+
+ ;; Move down
+ (dolist (v '("===" "^\\* heading-org 1$" "===" "^\\* heading-otl 1$"
+ "===" "^# heading-md 1$" "===" "^ +1\\. heading-kotl$"))
+ (should (and (looking-at-p v) (hact 'kbd-key "n"))))
+ (should (eobp))
+
+ ;; Move up
+ (dolist (v '("^ +1\\. heading-kotl$" "===" "^# heading-md 1$" "==="
+ "^\\* heading-otl 1$" "===" "^\\* heading-org 1$"
"==="))
+ (should (and (hact 'kbd-key "p") (looking-at-p v))))
+ (should (= 1 (line-number-at-pos))))
+ (kill-buffer hyrolo-display-buffer)
+ (hy-delete-files-and-buffers hyrolo-file-list))))
+
+(defun hyrolo-tests--verify-hidden-line ()
+ "Verify that a line is hidden."
+ (save-excursion
+ (end-of-line)
+ (should (get-char-property (point) 'invisible))))
+
+(defun hyrolo-tests--verify-not-hidden-line ()
+ "Verify that a line is hidden."
+ (save-excursion
+ (end-of-line)
+ (should-not (get-char-property (point) 'invisible))))
(ert-deftest hyrolo-tests--outline-hide-show-heading ()
"Verify hiding and showing headings."
(skip-unless (version< org-version "9.6"))
(let* ((org-file (make-temp-file "hypb" nil ".org"
- (hyrolo-tests--gen-outline ?* "heading" 2
"body" 2)))
+ (hyrolo-tests--gen-outline ?* "heading" 1
"body" 2)))
(hyrolo-file-list (list org-file)))
(unwind-protect
(progn
(hyrolo-grep "body")
(should (string= hyrolo-display-buffer (buffer-name)))
- ;; Hide first line hides whole section
+ ;; Hide/Show first line hides whole section
(should (looking-at-p "==="))
(should (hact 'kbd-key "h"))
- (end-of-line)
- (should (get-char-property (point) 'invisible))
- (goto-char (point-min))
- (should (hact 'kbd-key "a"))
- (should (looking-at-p "^===+$"))
+ (hyrolo-tests--verify-hidden-line)
+ (should (hact 'kbd-key "s"))
+ (hyrolo-tests--verify-not-hidden-line)
+ ;; Hide/Show first section heading
+ (should (hact 'kbd-key "n"))
+ (should (looking-at-p "^\\* heading 1$"))
+ (should (hact 'kbd-key "h"))
+ (hyrolo-tests--verify-hidden-line)
+ (save-excursion
+ (next-line)
+ (should (eobp)))
+ (should (hact 'kbd-key "s"))
+ (hyrolo-tests--verify-not-hidden-line)
+
+ ;; Hide/Show level 2 heading
(should (hact 'kbd-key "n"))
- (should (looking-at-p "^* heading 1$"))
- ;; BUG: This gives an unexpected error when trying to hide
- ;; org-fold-region: Calling ‘org-fold-core-region’ with missing SPEC
+ (should (looking-at-p "^\\*\\* heading 1\\.2$"))
(should (hact 'kbd-key "h"))
- ;; Expected is not to fail on hiding the heading.
- ;; Seems to be version dependent for 29 and 30!?
+ (hyrolo-tests--verify-hidden-line)
+ (save-excursion
+ (next-line)
+ (should (eobp)))
+ (should (hact 'kbd-key "s"))
+ (hyrolo-tests--verify-not-hidden-line))
+ (kill-buffer hyrolo-display-buffer)
+ (hy-delete-files-and-buffers hyrolo-file-list))))
- ;; TBC - When bug above is resolved or understood better.
- )
+(ert-deftest hyrolo-tests--outline-show-when-moving-out-of-hidden-line ()
+ "Verify region is shown after moving out of hidden area."
+ (skip-unless (version< org-version "9.6"))
+ (let* ((org-file (make-temp-file "hypb" nil ".org"
+ (hyrolo-tests--gen-outline ?* "heading" 1
"body" 2)))
+ (hyrolo-file-list (list org-file)))
+ (unwind-protect
+ (progn
+ (hyrolo-grep "body")
+ (should (string= hyrolo-display-buffer (buffer-name)))
+
+ ;; Hide first line hides whole section
+ (should (looking-at-p "==="))
+ (should (hact 'kbd-key "h"))
+ (hyrolo-tests--verify-hidden-line)
+
+ ;; Move to first heading and back to top
+ (should (hact 'kbd-key "n"))
+ (should (looking-at-p "^\\* heading 1$"))
+ (should (hact 'kbd-key "p"))
+ (should (and (looking-at-p "===") (= 1 (line-number-at-pos))))
+ (hyrolo-tests--verify-not-hidden-line))
(kill-buffer hyrolo-display-buffer)
- (hy-delete-file-and-buffer org-file))))
+ (hy-delete-files-and-buffers hyrolo-file-list))))
(ert-deftest hyrolo-tests--tab-through-matches ()
"Verify tabbing through search matches."
@@ -691,7 +870,7 @@ Example:
(should (looking-at-p "^body 1$"))
(should-error (hact 'kbd-key "<backtab>")))
(kill-buffer hyrolo-display-buffer)
- (hy-delete-file-and-buffer org-file))))
+ (hy-delete-files-and-buffers hyrolo-file-list))))
(ert-deftest hyrolo-tests--edit-entry ()
"Verify {e} brings up entry in new window."
@@ -723,7 +902,7 @@ Example:
(should (looking-at-p "^body 1\\.2$"))
)
(kill-buffer hyrolo-display-buffer)
- (hy-delete-file-and-buffer org-file))))
+ (hy-delete-files-and-buffers hyrolo-file-list))))
(provide 'hyrolo-tests)
;;; hyrolo-tests.el ends here
- [elpa] externals/hyperbole 5d27b22695 129/143: Add overview and top-level outline tests, (continued)
- [elpa] externals/hyperbole 5d27b22695 129/143: Add overview and top-level outline tests, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 6befc489c5 131/143: Autoload `hypb:add-to-invisibility-spec' used in kotl-mode, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole c5b276b61e 142/143: HyRolo - `hyrolo-outline-minor-mode' expands invisible text at point, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 93ff5acf4b 140/143: hyrolo.el - Add default hyrolo-entry-group-number for hyrolo-mode, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole b3a0a7d2e2 038/143: Merge remote branch 'rsw' of hyperbole into rsw, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 6c7b8e5afb 048/143: Add helper for generating org files + two tests using the matches, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 8d9b7f0dde 032/143: hyrolo-tests.el - "*HyRolo*" literal to `hyrolo-display-buffer' var, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole c2bf47c15b 068/143: xref is used by etags since 26.1 so use it unconditionally (#432), ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 327f53f078 069/143: Mock y-or-n-p to avoid being prompted (#433), ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole e88a3873ed 073/143: htype:def-symbol, htype:names, actype:def-symbol - Call update, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole eeb6aacd9f 075/143: Add more hyrolo show, hide and movement tests (#436),
ELPA Syncer <=
- [elpa] externals/hyperbole 47d87c252f 113/143: HyRolo - resolve all outline movement issues and tests, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 7b50db7eb0 085/143: Matsl rsw forward backward same level tests (#443), ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 3d80bcbaf4 109/143: Merge branch 'rsw' of hyperbole into rsw, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 1078846a45 120/143: Update generation of README.md.html for increased reliability, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 970a5573f3 133/143: Merge branch 'rsw' into matsl-rsw-add-top-view-n-overview-tests, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 7c7aae7206 052/143: Add edit entry test, fix regular expressions, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 6009912456 128/143: Add type of but in error message, renamed but parameter, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 7d485ab5ff 136/143: hbut:act-label: Add to match same func for ebuts and ibuts, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 9a39300fcb 135/143: Merge branch 'rsw' of hyperbole into rsw, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole d55d57664c 139/143: Remove ad hoc flycheck warnings (#468), ELPA Syncer, 2024/02/19