[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole ae55b5cf79 11/13: Merge pull request #408 fro
From: |
ELPA Syncer |
Subject: |
[elpa] externals/hyperbole ae55b5cf79 11/13: Merge pull request #408 from rswgnu/hyrolo-test-cases |
Date: |
Fri, 1 Dec 2023 06:58:09 -0500 (EST) |
branch: externals/hyperbole
commit ae55b5cf79a4ee208718059db633680f79856f84
Merge: 8d5e95c659 e444389cdf
Author: Robert Weiner <rsw@gnu.org>
Commit: GitHub <noreply@github.com>
Merge pull request #408 from rswgnu/hyrolo-test-cases
Add hyrolo search test cases
---
ChangeLog | 14 +++++
test/hyrolo-tests.el | 174 ++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 187 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 94a79fbb4d..e738fae35c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
+2023-11-29 Mats Lidell <matsl@gnu.org>
+
+* test/hyrolo-tests.el (hyrolo-fgrep-and-goto-next-visible-org-heading)
+ (hyrolo-fgrep-and-goto-next-visible-kotl-heading)
+ (hyrolo-fgrep-and-goto-next-visible-outl-heading)
+ (hyrolo-fgrep-and-goto-next-visible-md-heading)
+ (hyrolo-fgrep-and-goto-next-visible-kotl-heading-level-2)
+ (hyrolo-fgrep-and-goto-next-visible-kotl-heading-cell-2): Add test for
+ moving to next header and that action-key then brings you to the
+ matching record.
+
2023-11-25 Mats Lidell <matsl@gnu.org>
+* test/hyrolo-tests.el (hyrolo-fgrep-find-all-types-of-files): Test that
+ all files types are searched, matches and give proper @loc>-header.
+
* hyrolo.el: Move private variables before their first use to remove
warnings.
diff --git a/test/hyrolo-tests.el b/test/hyrolo-tests.el
index 58bf06e6ef..53a9fe47fb 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: 17-Nov-23 at 10:48:26 by Bob Weiner
+;; Last-Mod: 29-Nov-23 at 23:22:15 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -23,6 +23,7 @@
(require 'hyrolo)
(require 'hyrolo-demo)
(require 'hy-test-helpers "test/hy-test-helpers")
+(require 'with-simulated-input)
(declare-function hy-test-helpers:consume-input-events "hy-test-helpers")
(declare-function hy-test-helpers:should-last-message "hy-test-helpers")
@@ -270,5 +271,176 @@ and {b} the previous same level cell."
(should (string= (buffer-string) sorted-hyrolo-file)))
(hy-delete-file-and-buffer hyrolo-file))))
+(ert-deftest hyrolo-fgrep-find-all-types-of-files ()
+ "Verify that all types of files are found in an fgrep search."
+ (let* ((temporary-file-directory (make-temp-file "hypb" t))
+ (org-file (make-temp-file "hypb" nil ".org" "string\n"))
+ (kotl-file (make-temp-file "hypb" nil ".kotl" "string"))
+ (md-file (make-temp-file "hypb" nil ".md" "string\n"))
+ (outl-file (make-temp-file "hypb" nil ".otl" "string\n"))
+ (hyrolo-file-list (list temporary-file-directory)))
+ (unwind-protect
+ (progn
+ (hyrolo-fgrep "string")
+ (with-current-buffer "*HyRolo*"
+ (should (= (how-many "@loc>") 4))
+ (dolist (f (list org-file kotl-file md-file outl-file))
+ (should (= (how-many (concat "@loc> \"" f "\"")) 1)))))
+ (dolist (f (list org-file kotl-file md-file outl-file))
+ (hy-delete-file-and-buffer f))
+ (kill-buffer "*HyRolo*")
+ (delete-directory temporary-file-directory))))
+
+(ert-deftest hyrolo-fgrep-and-goto-next-visible-org-heading ()
+ "Verify move to next heading, then action-key to go to record for org mode."
+ (let* ((temporary-file-directory (make-temp-file "hypb" t))
+ (org-file (make-temp-file "hypb" nil ".org" "*
heading\nstring\nmore\n"))
+ (hyrolo-file-list (list temporary-file-directory)))
+ (unwind-protect
+ (progn
+ (hyrolo-fgrep "string")
+ (with-current-buffer "*HyRolo*"
+ (should (= (how-many "@loc>") 1))
+ (should (looking-at-p "==="))
+ (hyrolo-next-visible-heading 1)
+ (should (looking-at-p "* heading")))
+ (with-simulated-input "y RET" ; Do you want to revisit the file
normally now?
+ (action-key)
+ (should (equal (current-buffer) (find-buffer-visiting org-file)))
+ (should (looking-at-p "* heading"))))
+ (hy-delete-file-and-buffer org-file)
+ (kill-buffer "*HyRolo*")
+ (delete-directory temporary-file-directory))))
+
+(ert-deftest hyrolo-fgrep-and-goto-next-visible-kotl-heading ()
+ "Verify move to next heading, then action-key to go to record for kotl mode."
+ (let* ((temporary-file-directory (make-temp-file "hypb" t))
+ (kotl-file (make-temp-file "hypb" nil ".kotl"))
+ (hyrolo-file-list (list temporary-file-directory)))
+ (unwind-protect
+ (progn
+ (find-file kotl-file)
+ (insert "heading")
+ (kotl-mode:newline 1)
+ (insert "string")
+ (kotl-mode:newline 1)
+ (insert "more")
+ (hyrolo-fgrep "string")
+ (with-current-buffer "*HyRolo*"
+ (should (= (how-many "@loc>") 1))
+ (should (looking-at-p "==="))
+ (hyrolo-next-visible-heading 1)
+ (should (looking-at-p ".*1\\. heading")))
+ (with-simulated-input "y RET" ; Do you want to revisit the file
normally now?
+ (action-key)
+ (should (equal (current-buffer) (find-buffer-visiting kotl-file)))
+ (should (looking-at-p "heading"))))
+ (hy-delete-file-and-buffer kotl-file)
+ (kill-buffer "*HyRolo*")
+ (delete-directory temporary-file-directory))))
+
+(ert-deftest hyrolo-fgrep-and-goto-next-visible-outl-heading ()
+ "Verify move to next heading, then action-key to go to record for outline
mode."
+ (let* ((temporary-file-directory (make-temp-file "hypb" t))
+ (outl-file (make-temp-file "hypb" nil ".otl" "*
heading\nstring\nmore\n"))
+ (hyrolo-file-list (list temporary-file-directory)))
+ (unwind-protect
+ (progn
+ (hyrolo-fgrep "string")
+ (with-current-buffer "*HyRolo*"
+ (should (= (how-many "@loc>") 1))
+ (should (looking-at-p "==="))
+ (hyrolo-next-visible-heading 1)
+ (should (looking-at-p "* heading")))
+ (with-simulated-input "y RET" ; Do you want to revisit the file
normally now?
+ (action-key)
+ (should (equal (current-buffer) (find-buffer-visiting outl-file)))
+ (should (looking-at-p "* heading"))))
+ (hy-delete-file-and-buffer outl-file)
+ (kill-buffer "*HyRolo*")
+ (delete-directory temporary-file-directory))))
+
+(ert-deftest hyrolo-fgrep-and-goto-next-visible-md-heading ()
+ "Verify move to next heading, then action-key to go to record for markdown
mode."
+ :expected-result :failed
+ (let* ((temporary-file-directory (make-temp-file "hypb" t))
+ (md-file (make-temp-file "hypb" nil ".md" "##
heading\nstring\nmore\n"))
+ (hyrolo-file-list (list temporary-file-directory)))
+ (unwind-protect
+ (progn
+ (hyrolo-fgrep "string")
+ (with-current-buffer "*HyRolo*"
+ (should (= (how-many "@loc>") 1))
+ (should (looking-at-p "==="))
+ (hyrolo-next-visible-heading 1)
+ (should (looking-at-p "## heading")))
+ (with-simulated-input "y RET" ; Do you want to revisit the file
normally now?
+ (action-key)
+ (should (equal (current-buffer) (find-buffer-visiting md-file)))
+ (should (looking-at-p "## heading"))))
+ (hy-delete-file-and-buffer md-file)
+ (kill-buffer "*HyRolo*")
+ (delete-directory temporary-file-directory))))
+
+(ert-deftest hyrolo-fgrep-and-goto-next-visible-kotl-heading-level-2 ()
+ "Verify move to next heading, then action-key to go to record for kotl mode.
+Match a string in a level 2 child cell."
+ (let* ((temporary-file-directory (make-temp-file "hypb" t))
+ (kotl-file (make-temp-file "hypb" nil ".kotl"))
+ (hyrolo-file-list (list temporary-file-directory)))
+ (unwind-protect
+ (progn
+ (find-file kotl-file)
+ (insert "first")
+ (kotl-mode:add-child)
+ (insert "heading")
+ (kotl-mode:newline 1)
+ (insert "string")
+ (kotl-mode:newline 1)
+ (insert "more")
+ (hyrolo-fgrep "string")
+ (with-current-buffer "*HyRolo*"
+ (should (= (how-many "@loc>") 1))
+ (should (looking-at-p "==="))
+ (hyrolo-next-visible-heading 1)
+ (should (looking-at-p ".*1a\\. heading")))
+ (with-simulated-input "y RET" ; Do you want to revisit the file
normally now?
+ (action-key)
+ (should (equal (current-buffer) (find-buffer-visiting kotl-file)))
+ (should (looking-at-p "heading"))))
+ (hy-delete-file-and-buffer kotl-file)
+ (kill-buffer "*HyRolo*")
+ (delete-directory temporary-file-directory))))
+
+(ert-deftest hyrolo-fgrep-and-goto-next-visible-kotl-heading-cell-2 ()
+ "Verify move to next heading, then action-key to go to record for kotl mode.
+Match a string in the second cell."
+ (let* ((temporary-file-directory (make-temp-file "hypb" t))
+ (kotl-file (make-temp-file "hypb" nil ".kotl"))
+ (hyrolo-file-list (list temporary-file-directory)))
+ (unwind-protect
+ (progn
+ (find-file kotl-file)
+ (insert "first")
+ (kotl-mode:add-cell)
+ (insert "heading")
+ (kotl-mode:newline 1)
+ (insert "string")
+ (kotl-mode:newline 1)
+ (insert "more")
+ (hyrolo-fgrep "string")
+ (with-current-buffer "*HyRolo*"
+ (should (= (how-many "@loc>") 1))
+ (should (looking-at-p "==="))
+ (hyrolo-next-visible-heading 1)
+ (should (looking-at-p ".*2\\. heading")))
+ (with-simulated-input "y RET" ; Do you want to revisit the file
normally now?
+ (action-key)
+ (should (equal (current-buffer) (find-buffer-visiting kotl-file)))
+ (should (looking-at-p "heading"))))
+ (hy-delete-file-and-buffer kotl-file)
+ (kill-buffer "*HyRolo*")
+ (delete-directory temporary-file-directory))))
+
(provide 'hyrolo-tests)
;;; hyrolo-tests.el ends here
- [elpa] externals/hyperbole updated (9d596dcc72 -> 3692855fa8), ELPA Syncer, 2023/12/01
- [elpa] externals/hyperbole 0702872981 02/13: Verify searching all file types with matches gives @loc> headers, ELPA Syncer, 2023/12/01
- [elpa] externals/hyperbole f7e0d15ac8 04/13: More kotl mode tests with hyrolo-fgrep, ELPA Syncer, 2023/12/01
- [elpa] externals/hyperbole 4e625d0fb9 01/13: Add test for demo key series M-x dired-other-window example, ELPA Syncer, 2023/12/01
- [elpa] externals/hyperbole d842b4a0fc 03/13: Test moving to next header, then using action-key to get to record., ELPA Syncer, 2023/12/01
- [elpa] externals/hyperbole ae55b5cf79 11/13: Merge pull request #408 from rswgnu/hyrolo-test-cases,
ELPA Syncer <=
- [elpa] externals/hyperbole 13abbb4e86 05/13: Add tests for ebut-link-directly, ELPA Syncer, 2023/12/01
- [elpa] externals/hyperbole 3dd0dc156b 06/13: Add tests for gbut-link-directly, ELPA Syncer, 2023/12/01
- [elpa] externals/hyperbole e444389cdf 09/13: Merge branch 'master' into hyrolo-test-cases, ELPA Syncer, 2023/12/01
- [elpa] externals/hyperbole 12c2f5d851 12/13: Merge branch 'master' into add-tests-for-ebut-link-directly, ELPA Syncer, 2023/12/01
- [elpa] externals/hyperbole 3692855fa8 13/13: Merge pull request #410 from rswgnu/add-tests-for-ebut-link-directly, ELPA Syncer, 2023/12/01
- [elpa] externals/hyperbole 064c23c30e 07/13: Merge branch 'master' into add-key-series-test-for-braces, ELPA Syncer, 2023/12/01
- [elpa] externals/hyperbole 8d5e95c659 08/13: Merge pull request #406 from rswgnu/add-key-series-test-for-braces, ELPA Syncer, 2023/12/01
- [elpa] externals/hyperbole 68d46e030e 10/13: Merge branch 'master' into add-tests-for-ebut-link-directly, ELPA Syncer, 2023/12/01