[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole 2f2d51b816 088/143: Merge pull request #444 f
From: |
ELPA Syncer |
Subject: |
[elpa] externals/hyperbole 2f2d51b816 088/143: Merge pull request #444 from rswgnu/matsl-rsw-add-tests-for-forward-and-backwards-using-multi-file-and-depth-structure |
Date: |
Mon, 19 Feb 2024 15:59:12 -0500 (EST) |
branch: externals/hyperbole
commit 2f2d51b81629f4e1a6117fad3ef7b13473765923
Merge: 3206c44448 34d4e22f28
Author: Robert Weiner <rsw@gnu.org>
Commit: GitHub <noreply@github.com>
Merge pull request #444 from
rswgnu/matsl-rsw-add-tests-for-forward-and-backwards-using-multi-file-and-depth-structure
Add tests with more file types and outline structure depth
---
ChangeLog | 13 +++++++
test/hyrolo-tests.el | 103 ++++++++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 106 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 61f4713b19..29c3685002 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2024-01-16 Mats Lidell <matsl@gnu.org>
+
+* test/hyrolo-tests.el
+ (hyrolo-tests--forward-same-level-all-file-types-level1-depth2)
+ (hyrolo-tests--forward-same-level-all-file-types-level2): Add test
+ with more file types and second level headings.
+
+ (hyrolo-tests--outline-content-org, hyrolo-tests--outline-content-otl)
+ (hyrolo-tests--outline-content-md); Add test content constants.
+
+ (hyrolo-tests--gen-kotl-outline): Add depth arg to kotl to generate
+ child cells in test data.
+
2024-01-15 Mats Lidell <matsl@gnu.org>
* test/hyrolo-tests.el (hyrolo-tests--forward-same-level-all-file-types-level1)
diff --git a/test/hyrolo-tests.el b/test/hyrolo-tests.el
index 3c4ae188d1..17a8fadba3 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: 15-Jan-24 at 00:38:13 by Mats Lidell
+;; Last-Mod: 16-Jan-24 at 00:05:00 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -702,15 +702,22 @@ Example:
(kill-buffer hyrolo-display-buffer)
(hy-delete-files-and-buffers hyrolo-file-list))))
-(defun hyrolo-tests--gen-kotl-outline (heading body)
+(defun hyrolo-tests--gen-kotl-outline (heading body &optional depth)
"Generate a temp file with kotl outline structure for hyrolo outline test.
-Make cell start with HEADING and follow by next line BODY."
+Make cell start with HEADING and follow by next line BODY. With
+optional DEPTH the number of sub cells are created to that depth."
(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)
+ (when (and depth (< 0 depth))
+ (dotimes (d depth)
+ (kotl-mode:add-child)
+ (insert (format "%s %d" heading (1+ d)))
+ (kotl-mode:newline 1)
+ (insert (format "%s %d" body (1+ d)))))
(save-buffer)
kotl-file))
@@ -934,10 +941,40 @@ All files types are present."
(kill-buffer hyrolo-display-buffer)
(hy-delete-files-and-buffers hyrolo-file-list))))
-(ert-deftest hyrolo-tests--forward-same-level-org-level2 ()
- "Verify forward and backward to second level headers with org files."
- (let* ((content
- "\
+(ert-deftest hyrolo-tests--forward-same-level-all-file-types-level1-depth2 ()
+ "Verify forward and backward to first level headers and section lines.
+All files types are present with a max depth of 2 of the outline
+structure."
+ :expected-result :failed
+ (let* ((org-file1 (make-temp-file "hypb" nil ".org"
+ (hyrolo-tests--gen-outline ?*
"heading-org" 1 "body-org" 2)))
+ (md-file1 (make-temp-file "hypb" nil ".md"
+ (hyrolo-tests--gen-outline ?# "heading-md"
1 "body-md" 2)))
+ (otl-file1 (make-temp-file "hypb" nil ".otl"
+ (hyrolo-tests--gen-outline ?*
"heading-otl" 1 "body-otl" 2)))
+ (kotl-file1 (hyrolo-tests--gen-kotl-outline "heading-kotl"
"body-kotl" 2))
+ (hyrolo-file-list (list org-file1 md-file1 otl-file1 kotl-file1)))
+ (unwind-protect
+ (progn
+ (hyrolo-grep "body")
+ (should (string= hyrolo-display-buffer (buffer-name)))
+
+ ;; Move forward
+ (dolist (v '("===" "^\\* heading-org 1$" "===" "^# heading-md 1$"
+ "===" "^\\* heading-otl 1$" "===" "^ +1\\.
heading-kotl$"))
+ (should (and (looking-at-p v) (hact 'kbd-key "f"))))
+ (should (looking-at-p "^ +1\\. heading-kotl$")) ; When on last match
do not move further
+
+ ;; Move backward
+ (dolist (v '("===" "^\\* heading-otl 1$" "===" "^# heading-md 1$"
+ "===" "^\\* heading-org 1$" "==="))
+ (should (and (hact 'kbd-key "b") (looking-at-p v))))
+ (should (= 1 (line-number-at-pos))))
+ (kill-buffer hyrolo-display-buffer)
+ (hy-delete-files-and-buffers hyrolo-file-list))))
+
+(defconst hyrolo-tests--outline-content-org
+ "\
* h-org 1
body
** h-org 1.1
@@ -950,9 +987,22 @@ body
body
** h-org-2.1
body
-")
- (org-file1 (make-temp-file "hypb" nil ".org" content))
- (org-file2 (make-temp-file "hypb" nil ".org" content))
+"
+ "Outline content for org files.")
+
+(defconst hyrolo-tests--outline-content-otl
+ (string-replace "org" "otl" hyrolo-tests--outline-content-org)
+ "Outline content for otl files.")
+
+(defconst hyrolo-tests--outline-content-md
+ (string-replace "*" "#"
+ (string-replace "org" "md"
hyrolo-tests--outline-content-org))
+ "Outline content for markdown files.")
+
+(ert-deftest hyrolo-tests--forward-same-level-org-level2 ()
+ "Verify forward and backward to second level headers with org files."
+ (let* ((org-file1 (make-temp-file "hypb" nil ".org"
hyrolo-tests--outline-content-org))
+ (org-file2 (make-temp-file "hypb" nil ".org"
hyrolo-tests--outline-content-org))
(hyrolo-file-list (list org-file1 org-file2)))
(unwind-protect
(progn
@@ -980,5 +1030,38 @@ body
(kill-buffer hyrolo-display-buffer)
(hy-delete-files-and-buffers hyrolo-file-list))))
+(ert-deftest hyrolo-tests--forward-same-level-all-file-types-level2 ()
+ "Verify forward and backward to second level headers with org files."
+ (let* ((org-file1 (make-temp-file "hypb" nil ".org"
hyrolo-tests--outline-content-org))
+ (otl-file1 (make-temp-file "hypb" nil ".otl"
hyrolo-tests--outline-content-otl))
+ (md-file1 (make-temp-file "hypb" nil ".md"
hyrolo-tests--outline-content-md))
+ (kotl-file1 (hyrolo-tests--gen-kotl-outline "heading-kotl"
"body-kotl" 2))
+ (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 to first second level header
+ (search-forward "** h-org 1.1")
+ (beginning-of-line)
+ (should (looking-at-p "^\\*\\* h-org 1\\.1"))
+
+ ;; Move forward same level
+ (should (and (hact 'kbd-key "f") (looking-at-p "^\\*\\* h-org
1\\.2")))
+
+ ;; Multiple times does not move point when there are no more headers
at the same level
+ (should (and (hact 'kbd-key "f") (looking-at-p "^\\*\\* h-org
1\\.2")))
+ (should (and (hact 'kbd-key "f") (looking-at-p "^\\*\\* h-org
1\\.2")))
+
+ ;; Move back on same level
+ (should (and (hact 'kbd-key "b") (looking-at-p "\\*\\* h-org
1\\.1")))
+
+ ;; Moving up from first header on a level errors, also when repeated.
+ (should-error (and (hact 'kbd-key "b") (looking-at-p "^\\*\\* h-org
1\\.1")))
+ (should-error (and (hact 'kbd-key "b") (looking-at-p "^\\*\\* h-org
1\\.1"))))
+ (kill-buffer hyrolo-display-buffer)
+ (hy-delete-files-and-buffers hyrolo-file-list))))
+
(provide 'hyrolo-tests)
;;; hyrolo-tests.el ends here
- [elpa] externals/hyperbole 7a5e3071b6 097/143: Merge branch 'rsw' of hyperbole into rsw, (continued)
- [elpa] externals/hyperbole 7a5e3071b6 097/143: Merge branch 'rsw' of hyperbole into rsw, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole ac7d6ed874 106/143: Remove unused function (#455), ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 678f62a79d 105/143: hyperbole-web-search: when service is a func, let it prompt for term, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole c4325885a0 114/143: Add single file match tests for some hyrolo hide and show commands (#458), ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 29fd0c8540 060/143: Update manual for "hsys-flymake.el" and add to hkey-alist, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 721ab10894 063/143: hsys-flymake.el improvements; hyrolo-tests.el improvements, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 270aab31c7 074/143: Matsl rsw fix more warnings reported by ci/cd (#438), ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole d5a9715ef0 079/143: Fix hyrolo-org-mode to conditionalize ref to org-fold if unbound, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 34d4e22f28 087/143: Add tests with more file types and outline structure depth, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 2c67943e47 084/143: Fix a few warnings/bugs pointed out by the byte-compiler, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 2f2d51b816 088/143: Merge pull request #444 from rswgnu/matsl-rsw-add-tests-for-forward-and-backwards-using-multi-file-and-depth-structure,
ELPA Syncer <=
- [elpa] externals/hyperbole 7ad3cabb7e 098/143: Revert "Remove skip guard on test that works in batch mode" (#448), ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 68564a0f0d 110/143: Enable HyRolo's extended reveal-mode used in *HyRolo* buffer, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 92ee298bf4 111/143: HyRolo - Fix major-mode and reveal-mode issues affecting *HyRolo*, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 5e85e72772 107/143: hyperbole-web-search-alist: Add 'ducKduckgo' search engine, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 2f5d06dd4c 012/143: Add tests for hpath:expand and hpath:expand-list, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole c73e948516 022/143: Merge pull request #422 from rswgnu/matsl-rsw-hui-link-possible-types, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole f4fccc5abf 025/143: Merge pull request #423 from rswgnu/matsl-rsw-ignore-local-vars-in-demo, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole d4c881007b 035/143: Add remaining test cases for fast-demo, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 1e8006fc19 053/143: Fix more regexps and remove not working visibility check, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 1e1d2950e4 041/143: hyperbole.texi - add doc for Smark Key handling in ERT result bufs, ELPA Syncer, 2024/02/19