[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 5c05ac198a 069/101: testing: Test with and without
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 5c05ac198a 069/101: testing: Test with and without cache in more cases |
Date: |
Sat, 1 Jul 2023 09:59:14 -0400 (EDT) |
branch: externals/org
commit 5c05ac198a58e28f8c6a77f8e4c06c34f0b23f23
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>
testing: Test with and without cache in more cases
---
testing/lisp/test-org-agenda.el | 25 ++--
testing/lisp/test-org.el | 269 ++++++++++++++++++++--------------------
2 files changed, 148 insertions(+), 146 deletions(-)
diff --git a/testing/lisp/test-org-agenda.el b/testing/lisp/test-org-agenda.el
index c138d5668c..22e3106ec1 100644
--- a/testing/lisp/test-org-agenda.el
+++ b/testing/lisp/test-org-agenda.el
@@ -85,18 +85,19 @@
(cl-assert (not org-agenda-sticky) nil "precondition violation")
(cl-assert (not (org-test-agenda--agenda-buffers))
nil "precondition violation")
- (let ((org-agenda-span 'day)
- (org-agenda-files `(,(expand-file-name "examples/agenda-file.org"
- org-test-dir))))
- ;; NOTE: Be aware that `org-agenda-list' may or may not display
- ;; past scheduled items depending whether the date is today
- ;; `org-today' or not.
- (org-agenda-list nil "<2017-07-19 Wed>")
- (set-buffer org-agenda-buffer-name)
- (should
- (progn (goto-line 3)
- (looking-at " *agenda-file:Scheduled: *test agenda"))))
- (org-test-agenda--kill-all-agendas))
+ (dolist (org-element-use-cache '(t nil))
+ (let ((org-agenda-span 'day)
+ (org-agenda-files `(,(expand-file-name "examples/agenda-file.org"
+ org-test-dir))))
+ ;; NOTE: Be aware that `org-agenda-list' may or may not display
+ ;; past scheduled items depending whether the date is today
+ ;; `org-today' or not.
+ (org-agenda-list nil "<2017-07-19 Wed>")
+ (set-buffer org-agenda-buffer-name)
+ (should
+ (progn (goto-line 3)
+ (looking-at " *agenda-file:Scheduled: *test agenda"))))
+ (org-test-agenda--kill-all-agendas)))
(ert-deftest test-org-agenda/non-scheduled-re-matces ()
"Make sure that scheduled-looking elements do not appear in agenda.
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index bd8f905d7b..08cda543ad 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -2686,59 +2686,60 @@ Test
(ert-deftest test-org/map-entries ()
"Test `org-map-entries' specifications."
- ;; Full match.
- (should
- (equal '(1 11)
- (org-test-with-temp-text "* Level 1\n** Level 2"
- (org-map-entries #'point))))
- ;; Level match.
- (should
- (equal '(1)
- (org-test-with-temp-text "* Level 1\n** Level 2"
- (let (org-odd-levels-only) (org-map-entries #'point "LEVEL=1")))))
- (should
- (equal '(11)
- (org-test-with-temp-text "* Level 1\n** Level 2"
- (let (org-odd-levels-only) (org-map-entries #'point "LEVEL>1")))))
- ;; Tag match.
- (should
- (equal '(11)
- (org-test-with-temp-text "* H1 :no:\n* H2 :yes:"
- (org-map-entries #'point "yes"))))
- (should
- (equal '(14)
- (org-test-with-temp-text "* H1 :yes:a:\n* H2 :yes:b:"
- (org-map-entries #'point "+yes-a"))))
- (should
- (equal '(11 23)
- (org-test-with-temp-text "* H1 :no:\n* H2 :yes1:\n* H3 :yes2:"
- (org-map-entries #'point "{yes?}"))))
- ;; Priority match.
- (should
- (equal '(1)
- (org-test-with-temp-text "* [#A] H1\n* [#B] H2"
- (org-map-entries #'point "PRIORITY=\"A\""))))
- ;; Date match.
- (should
- (equal '(36)
- (org-test-with-temp-text "
+ (dolist (org-element-use-cache '(t nil))
+ ;; Full match.
+ (should
+ (equal '(1 11)
+ (org-test-with-temp-text "* Level 1\n** Level 2"
+ (org-map-entries #'point))))
+ ;; Level match.
+ (should
+ (equal '(1)
+ (org-test-with-temp-text "* Level 1\n** Level 2"
+ (let (org-odd-levels-only) (org-map-entries #'point "LEVEL=1")))))
+ (should
+ (equal '(11)
+ (org-test-with-temp-text "* Level 1\n** Level 2"
+ (let (org-odd-levels-only) (org-map-entries #'point "LEVEL>1")))))
+ ;; Tag match.
+ (should
+ (equal '(11)
+ (org-test-with-temp-text "* H1 :no:\n* H2 :yes:"
+ (org-map-entries #'point "yes"))))
+ (should
+ (equal '(14)
+ (org-test-with-temp-text "* H1 :yes:a:\n* H2 :yes:b:"
+ (org-map-entries #'point "+yes-a"))))
+ (should
+ (equal '(11 23)
+ (org-test-with-temp-text "* H1 :no:\n* H2 :yes1:\n* H3 :yes2:"
+ (org-map-entries #'point "{yes?}"))))
+ ;; Priority match.
+ (should
+ (equal '(1)
+ (org-test-with-temp-text "* [#A] H1\n* [#B] H2"
+ (org-map-entries #'point "PRIORITY=\"A\""))))
+ ;; Date match.
+ (should
+ (equal '(36)
+ (org-test-with-temp-text "
* H1
SCHEDULED: <2012-03-29 thu.>
* H2
SCHEDULED: <2014-03-04 tue.>"
- (org-map-entries #'point "SCHEDULED=\"<2014-03-04 tue.>\""))))
- (should
- (equal '(2)
- (org-test-with-temp-text "
+ (org-map-entries #'point "SCHEDULED=\"<2014-03-04 tue.>\""))))
+ (should
+ (equal '(2)
+ (org-test-with-temp-text "
* H1
SCHEDULED: <2012-03-29 thu.>
* H2
SCHEDULED: <2014-03-04 tue.>"
- (org-map-entries #'point "SCHEDULED<\"<2013-01-01>\""))))
- ;; Regular property match.
- (should
- (equal '(2)
- (org-test-with-temp-text "
+ (org-map-entries #'point "SCHEDULED<\"<2013-01-01>\""))))
+ ;; Regular property match.
+ (should
+ (equal '(2)
+ (org-test-with-temp-text "
* H1
:PROPERTIES:
:TEST: 1
@@ -2747,97 +2748,97 @@ SCHEDULED: <2014-03-04 tue.>"
:PROPERTIES:
:TEST: 2
:END:"
- (org-map-entries #'point "TEST=1"))))
- ;; Multiple criteria.
- (should
- (equal '(23)
- (org-test-with-temp-text "* H1 :no:\n** H2 :yes:\n* H3 :yes:"
- (let (org-odd-levels-only
- (org-use-tag-inheritance nil))
- (org-map-entries #'point "yes+LEVEL=1")))))
- ;; "or" criteria.
- (should
- (equal '(12 24)
- (org-test-with-temp-text "* H1 :yes:\n** H2 :yes:\n** H3 :no:"
- (let (org-odd-levels-only)
- (org-map-entries #'point "LEVEL=2|no")))))
- (should
- (equal '(1 12)
- (org-test-with-temp-text "* H1 :yes:\n* H2 :no:\n* H3 :maybe:"
- (let (org-odd-levels-only)
- (org-map-entries #'point "yes|no")))))
- ;; "and" criteria.
- (should
- (equal '(22)
- (org-test-with-temp-text "* H1 :yes:\n* H2 :no:\n* H3 :yes:no:"
- (let (org-odd-levels-only)
- (org-map-entries #'point "yes&no")))))
- ;; Setting `org-map-continue-from'
- (should
- (string= ""
- (org-test-with-temp-text "* H1\n* H2\n* H3n* H4"
- (org-map-entries
- (lambda ()
- (org-cut-subtree)
- (setq org-map-continue-from (point))))
- (buffer-string))))
- (should
- (string= "* H1\n* H2\n* H3\n"
- (org-test-with-temp-text "* H1\n* H2\n* H3\n* H4"
- (org-map-entries
- (lambda ()
- (when (string= "H4"
- (org-element-property
- :raw-value (org-element-at-point)))
+ (org-map-entries #'point "TEST=1"))))
+ ;; Multiple criteria.
+ (should
+ (equal '(23)
+ (org-test-with-temp-text "* H1 :no:\n** H2 :yes:\n* H3 :yes:"
+ (let (org-odd-levels-only
+ (org-use-tag-inheritance nil))
+ (org-map-entries #'point "yes+LEVEL=1")))))
+ ;; "or" criteria.
+ (should
+ (equal '(12 24)
+ (org-test-with-temp-text "* H1 :yes:\n** H2 :yes:\n** H3 :no:"
+ (let (org-odd-levels-only)
+ (org-map-entries #'point "LEVEL=2|no")))))
+ (should
+ (equal '(1 12)
+ (org-test-with-temp-text "* H1 :yes:\n* H2 :no:\n* H3 :maybe:"
+ (let (org-odd-levels-only)
+ (org-map-entries #'point "yes|no")))))
+ ;; "and" criteria.
+ (should
+ (equal '(22)
+ (org-test-with-temp-text "* H1 :yes:\n* H2 :no:\n* H3 :yes:no:"
+ (let (org-odd-levels-only)
+ (org-map-entries #'point "yes&no")))))
+ ;; Setting `org-map-continue-from'
+ (should
+ (string= ""
+ (org-test-with-temp-text "* H1\n* H2\n* H3n* H4"
+ (org-map-entries
+ (lambda ()
(org-cut-subtree)
- (setq org-map-continue-from
- (org-element-property
- :begin (org-element-at-point))))))
- (buffer-string))))
- ;; Move point.
- (should
- (= 1
- (org-test-with-temp-text "* H1\n** H1.1\n** H1.2\n"
- (let (acc)
- (org-map-entries
- (lambda ()
- (push (org-element-property :title (org-element-at-point)) acc)
- (setq org-map-continue-from
- (org-element-property :end (org-element-at-point)))))
- (length acc)))))
- (should
- (= 2
- (org-test-with-temp-text "* H1\n** H1.1\n** H1.2\n"
- (let (acc)
- (org-map-entries
- (lambda ()
- (push (org-element-property :title (org-element-at-point)) acc)
- (setq org-map-continue-from
- (line-end-position 2))))
- (length acc)))))
- ;; Modifications inside indirect buffer.
- (should
- (= 3
- (org-test-with-temp-text "<point>* H1\n** H1.1\n** H1.2\n"
- (with-current-buffer (org-get-indirect-buffer)
- (let ((acc 0))
+ (setq org-map-continue-from (point))))
+ (buffer-string))))
+ (should
+ (string= "* H1\n* H2\n* H3\n"
+ (org-test-with-temp-text "* H1\n* H2\n* H3\n* H4"
+ (org-map-entries
+ (lambda ()
+ (when (string= "H4"
+ (org-element-property
+ :raw-value (org-element-at-point)))
+ (org-cut-subtree)
+ (setq org-map-continue-from
+ (org-element-property
+ :begin (org-element-at-point))))))
+ (buffer-string))))
+ ;; Move point.
+ (should
+ (= 1
+ (org-test-with-temp-text "* H1\n** H1.1\n** H1.2\n"
+ (let (acc)
(org-map-entries
(lambda ()
- (cl-incf acc)
- (beginning-of-line 2)
- (insert "test\n")
- (beginning-of-line -1)))
- acc)))))
- ;; Removing heading being processed.
- (should
- (equal
- "Some text
+ (push (org-element-property :title (org-element-at-point)) acc)
+ (setq org-map-continue-from
+ (org-element-property :end (org-element-at-point)))))
+ (length acc)))))
+ (should
+ (= 2
+ (org-test-with-temp-text "* H1\n** H1.1\n** H1.2\n"
+ (let (acc)
+ (org-map-entries
+ (lambda ()
+ (push (org-element-property :title (org-element-at-point)) acc)
+ (setq org-map-continue-from
+ (line-end-position 2))))
+ (length acc)))))
+ ;; Modifications inside indirect buffer.
+ (should
+ (= 3
+ (org-test-with-temp-text "<point>* H1\n** H1.1\n** H1.2\n"
+ (with-current-buffer (org-get-indirect-buffer)
+ (let ((acc 0))
+ (org-map-entries
+ (lambda ()
+ (cl-incf acc)
+ (beginning-of-line 2)
+ (insert "test\n")
+ (beginning-of-line -1)))
+ acc)))))
+ ;; Removing heading being processed.
+ (should
+ (equal
+ "Some text
Some text
Some more text
Let’s stop here
"
- (org-test-with-temp-text
- "* Heading 1
+ (org-test-with-temp-text
+ "* Heading 1
Some text
** Heading 1.1
Some text
@@ -2846,11 +2847,11 @@ Some more text
** Heading 2.1
Let’s stop here
"
- (org-map-entries
- (lambda ()
- (delete-region (point) (line-beginning-position 2))
- (setq org-map-continue-from (point))))
- (buffer-string)))))
+ (org-map-entries
+ (lambda ()
+ (delete-region (point) (line-beginning-position 2))
+ (setq org-map-continue-from (point))))
+ (buffer-string))))))
(ert-deftest test-org/edit-headline ()
"Test `org-edit-headline' specifications."
- [elpa] externals/org 4fcdcb456d 021/101: org-element: Defer large buffer substrings when parsing, (continued)
- [elpa] externals/org 4fcdcb456d 021/101: org-element: Defer large buffer substrings when parsing, ELPA Syncer, 2023/07/01
- [elpa] externals/org 01351f3eab 067/101: Restructure file organization, ELPA Syncer, 2023/07/01
- [elpa] externals/org 69383dfc24 031/101: org-ascii--current-justification: Use `org-element-lineage-map', ELPA Syncer, 2023/07/01
- [elpa] externals/org 771074ba5e 047/101: org-in-archived-heading-p: Use org-element API, ELPA Syncer, 2023/07/01
- [elpa] externals/org 5898fcf269 061/101: Remove unused declares, ELPA Syncer, 2023/07/01
- [elpa] externals/org 3ce57e17a0 071/101: org-item-re: Convert into defsubst, ELPA Syncer, 2023/07/01
- [elpa] externals/org 52c63f5cce 095/101: org-lint-export-option-keywords: Small refactoring, ELPA Syncer, 2023/07/01
- [elpa] externals/org 7f337a2b95 098/101: org-fold-core: Fix isearch with `org-fold-core-isearch-open-function', ELPA Syncer, 2023/07/01
- [elpa] externals/org afbbebff3f 097/101: org-fold-core-get-folding-spec: Respect `org-fold-core-style', ELPA Syncer, 2023/07/01
- [elpa] externals/org 80122a1204 008/101: org-element-ast: New function `org-element-property-2', ELPA Syncer, 2023/07/01
- [elpa] externals/org 5c05ac198a 069/101: testing: Test with and without cache in more cases,
ELPA Syncer <=
- [elpa] externals/org f63000cca8 075/101: org-element--current-element: Use "nogroup" versions of regexps, ELPA Syncer, 2023/07/01
- [elpa] externals/org f93d855c51 077/101: Prefer `forward-line' over `beginning-of-line', ELPA Syncer, 2023/07/01
- [elpa] externals/org 924a64da39 013/101: org-element: Use the new org-element-ast library, ELPA Syncer, 2023/07/01
- [elpa] externals/org a7d1dfa171 027/101: Use `org-element-type-p', ELPA Syncer, 2023/07/01
- [elpa] externals/org 607c230d74 041/101: org-with-point-at: Accept syntax node as POM, ELPA Syncer, 2023/07/01
- [elpa] externals/org ec8f359bd6 046/101: org-in-commented-heading-p: Use org-element API, ELPA Syncer, 2023/07/01
- [elpa] externals/org 06aba04f75 057/101: org-agenda-get-deadlines: Switch to org-element API, ELPA Syncer, 2023/07/01
- [elpa] externals/org 2b96501070 066/101: org-element: Simplify drawer and property drawer regexps, ELPA Syncer, 2023/07/01
- [elpa] externals/org a80efaf460 072/101: org-element-node-property-parser: Remove unnecessary regexp search, ELPA Syncer, 2023/07/01
- [elpa] externals/org 1c7c67b3c6 076/101: org-indent-drawer, org-indent-block: Remove unnecessary checks, ELPA Syncer, 2023/07/01