Browse Source

test-org-agenda: Test for scheduled-looking lines

* testing/examples/agenda-file.org: Add test headings where SCHEDULED
line is not planning.
*
testing/lisp/test-org-agenda.el (test-org-agenda/non-scheduled-re-matces):
Make sure that SCHEDULED lines that do no belong to planning do not
trigger agenda matches.

See https://list.orgmode.org/20220101200103.GB29829@itccanarias.org/T/#t
Ihor Radchenko 3 years ago
parent
commit
65f9524136
2 changed files with 24 additions and 0 deletions
  1. 10 0
      testing/examples/agenda-file.org
  2. 14 0
      testing/lisp/test-org-agenda.el

+ 10 - 0
testing/examples/agenda-file.org

@@ -6,3 +6,13 @@ SCHEDULED: <2017-07-19 Wed>
 ** subnote
 * test code 216bc1ff1d862e78183e38ee9a4da504919b9878
 <2019-01-08 Tue>
+* test agenda non-scheduled
+#+begin_src org
+SCHEDULED: <2022-01-03 Mon>
+#+end_src
+* colon scheduled entry
+: SCHEDULED: <2022-01-03 Mon>
+* begin_example scheduled entry
+#+begin_example
+SCHEDULED: <2022-01-03 Mon>
+#+end_example

+ 14 - 0
testing/lisp/test-org-agenda.el

@@ -92,6 +92,20 @@
 	    (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.
+See https://list.orgmode.org/20220101200103.GB29829@itccanarias.org/T/#t."
+  (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))))
+    (org-agenda-list nil "<2022-01-03 Mon>")
+    (set-buffer org-agenda-buffer-name)
+    (should (= 2 (count-lines (point-min) (point-max)))))
+  (org-test-agenda--kill-all-agendas))
+
 (ert-deftest test-org-agenda/set-priority ()
   "One informative line in the agenda. Check that org-agenda-priority updates the agenda."
   (cl-assert (not org-agenda-sticky) nil "precondition violation")