emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org 26440689aa 4/7: org-test-without-dow: Make name con


From: ELPA Syncer
Subject: [elpa] externals/org 26440689aa 4/7: org-test-without-dow: Make name consistent with what the macro does
Date: Mon, 17 Jul 2023 06:59:28 -0400 (EDT)

branch: externals/org
commit 26440689aab69d6a5fe49cf5460ed97e213e5a25
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    org-test-without-dow: Make name consistent with what the macro does
    
    * testing/lisp/test-org.el (org-test-without-dow): Do not implicitly
    call `org-test-with-result'.
    
    Update all the callers.
---
 testing/lisp/test-org.el | 220 ++++++++++++++++++++++++++++-------------------
 1 file changed, 130 insertions(+), 90 deletions(-)

diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 0886e9348c..9bfbe59658 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -69,13 +69,11 @@ Otherwise, evaluate RESULT as an sexp and return its 
result."
                                  (line-end-position ,result)))
              (_ result))))
 
-(defmacro org-test-without-dow (result &rest body)
-  "Eval BODY skipping day-of-week in timestamps.
-See `org-test-with-result' for RESULT and the return value."
-  (declare (indent 1))
+(defmacro org-test-without-dow (&rest body)
+  "Eval BODY skipping day-of-week in timestamps."
+  (declare (debug (body)))
   `(let ((org-time-stamp-formats '("%Y-%m-%d" . "%Y-%m-%d %H:%M")))
-     ;; ,(macroexpand-1 `(org-test-with-result ,result ,@body))
-     (org-test-with-result ,result ,@body)))
+     ,@body))
 
 
 ;;; Comments
@@ -2101,8 +2099,9 @@ CLOCK: [2022-09-17 sam. 11:00]--[2022-09-17 sam. 11:46] 
=>  0:46"
 * H1\n<2015-06-23>
 "
           (org-test-with-temp-text "* H1\n<2015-06-21>"
-            (org-test-without-dow 'buffer
-              (org-clone-subtree-with-time-shift 1 "+2d")))))
+            (org-test-without-dow
+             (org-test-with-result 'buffer
+               (org-clone-subtree-with-time-shift 1 "+2d"))))))
   ;; Clone repeating once.
   (should
    (equal "\
@@ -2111,8 +2110,9 @@ CLOCK: [2022-09-17 sam. 11:00]--[2022-09-17 sam. 11:46] 
=>  0:46"
 * H1\n<2015-06-25 +1w>
 "
           (org-test-with-temp-text "* H1\n<2015-06-21 +1w>"
-            (org-test-without-dow 'buffer
-              (org-clone-subtree-with-time-shift 1 "+2d")))))
+            (org-test-without-dow
+             (org-test-with-result 'buffer
+               (org-clone-subtree-with-time-shift 1 "+2d"))))))
   ;; Clone repeating once in backward.
   (should
    (equal "\
@@ -2121,16 +2121,18 @@ CLOCK: [2022-09-17 sam. 11:00]--[2022-09-17 sam. 11:46] 
=>  0:46"
 * H1\n<2015-06-17 +1w>
 "
           (org-test-with-temp-text "* H1\n<2015-06-21 +1w>"
-            (org-test-without-dow 'buffer
-              (org-clone-subtree-with-time-shift 1 "-2d")))))
+            (org-test-without-dow
+             (org-test-with-result 'buffer
+               (org-clone-subtree-with-time-shift 1 "-2d"))))))
   ;; Clone non-repeating zero times.
   (should
    (equal "\
 * H1\n<2015-06-21>
 "
           (org-test-with-temp-text "* H1\n<2015-06-21>"
-            (org-test-without-dow 'buffer
-              (org-clone-subtree-with-time-shift 0 "+2d")))))
+            (org-test-without-dow
+             (org-test-with-result 'buffer
+               (org-clone-subtree-with-time-shift 0 "+2d"))))))
   ;; Clone repeating "zero" times.
   (should
    (equal "\
@@ -2138,31 +2140,35 @@ CLOCK: [2022-09-17 sam. 11:00]--[2022-09-17 sam. 11:46] 
=>  0:46"
 * H1\n<2015-06-23 +1w>
 "
           (org-test-with-temp-text "* H1\n<2015-06-21 +1w>"
-            (org-test-without-dow 'buffer
-              (org-clone-subtree-with-time-shift 0 "+2d")))))
+            (org-test-without-dow
+             (org-test-with-result 'buffer
+               (org-clone-subtree-with-time-shift 0 "+2d"))))))
   ;; Clone with blank SHIFT argument.
   (should
    (string-prefix-p
     "* H <2012-03-29"
     (org-test-with-temp-text "* H <2012-03-29 Thu><point>"
-      (org-test-without-dow 2
-        (org-clone-subtree-with-time-shift 1 "")))))
+      (org-test-without-dow
+       (org-test-with-result 2
+         (org-clone-subtree-with-time-shift 1 ""))))))
   ;; Find time stamps before point.  If SHIFT is not specified, ask
   ;; for a time shift.
   (should
    (string-prefix-p
     "* H <2012-03-30"
     (org-test-with-temp-text "* H <2012-03-29 Thu><point>"
-      (org-test-without-dow 2
-        (org-clone-subtree-with-time-shift 1 "+1d")))))
+      (org-test-without-dow
+       (org-test-with-result 2
+         (org-clone-subtree-with-time-shift 1 "+1d"))))))
   (should
    (string-prefix-p
     "* H <2014-03-05"
     (org-test-with-temp-text "* H <2014-03-04 Tue><point>"
       (cl-letf (((symbol-function 'read-from-minibuffer)
                  (lambda (&rest _args) "+1d")))
-        (org-test-without-dow 2
-          (org-clone-subtree-with-time-shift 1))))))
+        (org-test-without-dow
+         (org-test-with-result 2
+           (org-clone-subtree-with-time-shift 1)))))))
   ;; Hour shift.
   (should
    (equal "\
@@ -2171,16 +2177,18 @@ CLOCK: [2022-09-17 sam. 11:00]--[2022-09-17 sam. 11:46] 
=>  0:46"
 * H1\n<2015-06-22 02:00>
 "
           (org-test-with-temp-text "* H1\n<2015-06-21 20:00>"
-            (org-test-without-dow 'buffer
-              (org-clone-subtree-with-time-shift 2 "+3h")))))
+            (org-test-without-dow
+             (org-test-with-result 'buffer
+               (org-clone-subtree-with-time-shift 2 "+3h"))))))
   (should
    (equal "\
 * H1\n<2015-06-21 20:00>
 * H1\n<2015-06-21 18:00>
 "
           (org-test-with-temp-text "* H1\n<2015-06-21 20:00>"
-            (org-test-without-dow 'buffer
-              (org-clone-subtree-with-time-shift 1 "-2h"))))))
+            (org-test-without-dow
+             (org-test-with-result 'buffer
+               (org-clone-subtree-with-time-shift 1 "-2h")))))))
 
 
 ;;; Fixed-Width Areas
@@ -5720,15 +5728,17 @@ Text.
    (equal "* H\n  DEADLINE: <2015-06-25>\nParagraph"
           (org-test-with-temp-text "* H\nParagraph<point>"
             (let ((org-adapt-indentation t))
-              (org-test-without-dow 'buffer
-                (org-add-planning-info 'deadline "<2015-06-25 Thu>"))))))
+              (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-add-planning-info 'deadline "<2015-06-25 Thu>")))))))
   ;; Create deadline when `org-adapt-indentation' is nil.
   (should
    (equal "* H\nDEADLINE: <2015-06-25>\nParagraph"
          (org-test-with-temp-text "* H\nParagraph<point>"
            (let ((org-adapt-indentation nil))
-             (org-test-without-dow 'buffer
-                (org-add-planning-info 'deadline "<2015-06-25 Thu>"))))))
+             (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-add-planning-info 'deadline "<2015-06-25 Thu>")))))))
   ;; Update deadline when `org-adapt-indentation' is non-nil.
   (should
    (equal "* H\n  DEADLINE: <2015-06-25>\nParagraph"
@@ -5737,8 +5747,9 @@ Text.
   DEADLINE: <2015-06-24 Wed>
 Paragraph<point>"
            (let ((org-adapt-indentation t))
-             (org-test-without-dow 'buffer
-                (org-add-planning-info 'deadline "<2015-06-25 Thu>"))))))
+             (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-add-planning-info 'deadline "<2015-06-25 Thu>")))))))
   ;; Update deadline when `org-adapt-indentation' is nil.
   (should
    (equal "* H\nDEADLINE: <2015-06-25>\nParagraph"
@@ -5747,22 +5758,25 @@ Paragraph<point>"
 DEADLINE: <2015-06-24 Wed>
 Paragraph<point>"
            (let ((org-adapt-indentation nil))
-             (org-test-without-dow 'buffer
-                (org-add-planning-info 'deadline "<2015-06-25 Thu>"))))))
+             (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-add-planning-info 'deadline "<2015-06-25 Thu>")))))))
   ;; Schedule when `org-adapt-indentation' is non-nil.
   (should
    (equal "* H\n  SCHEDULED: <2015-06-25>\nParagraph"
          (org-test-with-temp-text "* H\nParagraph<point>"
            (let ((org-adapt-indentation t))
-             (org-test-without-dow 'buffer
-                (org-add-planning-info 'scheduled "<2015-06-25 Thu>"))))))
+             (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-add-planning-info 'scheduled "<2015-06-25 Thu>")))))))
   ;; Schedule when `org-adapt-indentation' is nil.
   (should
    (equal "* H\nSCHEDULED: <2015-06-25>\nParagraph"
          (org-test-with-temp-text "* H\nParagraph<point>"
            (let ((org-adapt-indentation nil))
-             (org-test-without-dow 'buffer
-                (org-add-planning-info 'scheduled "<2015-06-25 Thu>"))))))
+             (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-add-planning-info 'scheduled "<2015-06-25 Thu>")))))))
   ;; Add deadline when scheduled.
   (should
    (equal "\
@@ -5774,8 +5788,9 @@ Paragraph"
   SCHEDULED: <2015-06-24>
 Paragraph<point>"
            (let ((org-adapt-indentation t))
-             (org-test-without-dow 'buffer
-                (org-add-planning-info 'deadline "<2015-06-25 Thu>"))))))
+             (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-add-planning-info 'deadline "<2015-06-25 Thu>")))))))
   ;; Remove middle entry.
   (should
    (equal "\
@@ -5787,8 +5802,9 @@ Paragraph"
   CLOSED: [2015-06-24] DEADLINE: <2015-06-25 Thu> SCHEDULED: <2015-06-24>
 Paragraph<point>"
            (let ((org-adapt-indentation t))
-             (org-test-without-dow 'buffer
-                (org-add-planning-info nil nil 'deadline))))))
+             (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-add-planning-info nil nil 'deadline)))))))
   ;; Remove last entry and then middle entry (order should not
   ;; matter).
   (should
@@ -5801,8 +5817,9 @@ Paragraph"
   CLOSED: [2015-06-24] DEADLINE: <2015-06-25 Thu> SCHEDULED: <2015-06-24 Wed>
 Paragraph<point>"
            (let ((org-adapt-indentation t))
-             (org-test-without-dow 'buffer
-                (org-add-planning-info nil nil 'scheduled 'deadline))))))
+             (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-add-planning-info nil nil 'scheduled 'deadline)))))))
   ;; Remove closed when `org-adapt-indentation' is non-nil.
   (should
    (equal "* H\n  DEADLINE: <2015-06-25>\nParagraph"
@@ -5811,8 +5828,9 @@ Paragraph<point>"
   CLOSED: [2015-06-25 Thu] DEADLINE: <2015-06-25>
 Paragraph<point>"
            (let ((org-adapt-indentation t))
-             (org-test-without-dow 'buffer
-                (org-add-planning-info nil nil 'closed))))))
+             (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-add-planning-info nil nil 'closed)))))))
   (should
    (equal "* H\n  Paragraph"
          (org-test-with-temp-text "\
@@ -5820,8 +5838,9 @@ Paragraph<point>"
   CLOSED: [2015-06-25 Thu]
   Paragraph<point>"
            (let ((org-adapt-indentation t))
-             (org-test-without-dow 'buffer
-                (org-add-planning-info nil nil 'closed))))))
+             (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-add-planning-info nil nil 'closed)))))))
   ;; Remove closed when `org-adapt-indentation' is nil.
   (should
    (equal "* H\nDEADLINE: <2015-06-25>\nParagraph"
@@ -5830,8 +5849,9 @@ Paragraph<point>"
 CLOSED: [2015-06-25 Thu] DEADLINE: <2015-06-25>
 Paragraph<point>"
            (let ((org-adapt-indentation nil))
-             (org-test-without-dow 'buffer
-                (org-add-planning-info nil nil 'closed))))))
+             (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-add-planning-info nil nil 'closed)))))))
   (should
    (equal "* H\nParagraph"
          (org-test-with-temp-text "\
@@ -5839,8 +5859,9 @@ Paragraph<point>"
   CLOSED: [2015-06-25 Thu]
 Paragraph<point>"
            (let ((org-adapt-indentation nil))
-             (org-test-without-dow 'buffer
-                (org-add-planning-info nil nil 'closed))))))
+             (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-add-planning-info nil nil 'closed)))))))
   ;; Remove closed entry and delete empty line.
   (should
    (equal "\
@@ -5851,8 +5872,9 @@ Paragraph"
   CLOSED: [2015-06-24 Wed]
 Paragraph<point>"
            (let ((org-adapt-indentation t))
-             (org-test-without-dow 'buffer
-                (org-add-planning-info nil nil 'closed))))))
+             (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-add-planning-info nil nil 'closed)))))))
   ;; Remove one entry and update another.
   (should
    (equal "* H\n  DEADLINE: <2015-06-25>\nParagraph"
@@ -5861,8 +5883,9 @@ Paragraph<point>"
   SCHEDULED: <2015-06-23 Tue> DEADLINE: <2015-06-24 Wed>
 Paragraph<point>"
            (let ((org-adapt-indentation t))
-             (org-test-without-dow 'buffer
-                (org-add-planning-info 'deadline "<2015-06-25 Thu>" 
'scheduled)))))))
+             (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-add-planning-info 'deadline "<2015-06-25 Thu>" 
'scheduled))))))))
 
 (ert-deftest test-org/deadline ()
   "Test `org-deadline' specifications."
@@ -5872,15 +5895,17 @@ Paragraph<point>"
          (org-test-with-temp-text "* H"
            (let ((org-adapt-indentation nil)
                  (org-last-inserted-timestamp nil))
-             (org-test-without-dow 'buffer
-                (org-deadline nil "<2012-03-29 Tue>"))))))
+             (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-deadline nil "<2012-03-29 Tue>")))))))
   (should
    (equal "* H\nDEADLINE: <2014-03-04>"
          (org-test-with-temp-text "* H\nDEADLINE: <2012-03-29>"
            (let ((org-adapt-indentation nil)
                  (org-last-inserted-timestamp nil))
-             (org-test-without-dow 'buffer
-                (org-deadline nil "<2014-03-04 Thu>"))))))
+             (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-deadline nil "<2014-03-04 Thu>")))))))
   ;; Accept delta time, e.g., "+2d".
   (should
    (equal "* H\nDEADLINE: <2015-03-04>"
@@ -5888,39 +5913,44 @@ Paragraph<point>"
            (org-test-with-temp-text "* H"
              (let ((org-adapt-indentation nil)
                    (org-last-inserted-timestamp nil))
-               (org-test-without-dow 'buffer
-                  (org-deadline nil "+1y")))))))
+               (org-test-without-dow
+                 (org-test-with-result 'buffer
+                   (org-deadline nil "+1y"))))))))
   ;; Preserve repeater.
   (should
    (equal "* H\nDEADLINE: <2012-03-29 +2y>"
          (org-test-with-temp-text "* H"
            (let ((org-adapt-indentation nil)
                  (org-last-inserted-timestamp nil))
-             (org-test-without-dow 'buffer
-                (org-deadline nil "<2012-03-29 Tue +2y>"))))))
+             (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-deadline nil "<2012-03-29 Tue +2y>")))))))
   ;; Preserve warning period.
   (should
    (equal "* H\nDEADLINE: <2021-07-20 -1d>"
          (org-test-with-temp-text "* H"
            (let ((org-adapt-indentation nil)
                  (org-last-inserted-timestamp nil))
-             (org-test-without-dow 'buffer
-                (org-deadline nil "<2021-07-20 Tue -1d>"))))))
+             (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-deadline nil "<2021-07-20 Tue -1d>")))))))
   (should
    (equal "* H\nDEADLINE: <2021-07-20 +1m -3d>"
          (org-test-with-temp-text "* H"
            (let ((org-adapt-indentation nil)
                  (org-last-inserted-timestamp nil))
-             (org-test-without-dow 'buffer
-                (org-deadline nil "<2021-07-20 Tue +1m -3d>"))))))
+             (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-deadline nil "<2021-07-20 Tue +1m -3d>")))))))
   ;; Remove CLOSED keyword, if any.
   (should
    (equal "* H\nDEADLINE: <2012-03-29>"
          (org-test-with-temp-text "* H\nCLOSED: [2017-01-25 Wed]"
            (let ((org-adapt-indentation nil)
                  (org-last-inserted-timestamp nil))
-             (org-test-without-dow 'buffer
-                (org-deadline nil "<2012-03-29 Tue>"))))))
+             (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-deadline nil "<2012-03-29 Tue>")))))))
   ;; With C-u argument, remove DEADLINE keyword.
   (should
    (equal "* H\n"
@@ -5968,8 +5998,9 @@ Paragraph<point>"
               (transient-mark-mode 1)
              (push-mark (point) t t)
              (goto-char (point-max))
-              (org-test-without-dow 'buffer
-               (org-deadline nil "2012-03-29"))))))
+              (org-test-without-dow
+               (org-test-with-result 'buffer
+                (org-deadline nil "2012-03-29")))))))
   (should-not
    (equal "* H1\nDEADLINE: <2012-03-29>\n* H2\nDEADLINE: <2012-03-29>"
          (org-test-with-temp-text "* H1\n* H2"
@@ -5979,8 +6010,9 @@ Paragraph<point>"
              (transient-mark-mode 1)
              (push-mark (point) t t)
              (goto-char (point-max))
-             (org-test-without-dow 'buffer
-                (org-deadline nil "2012-03-29")))))))
+             (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-deadline nil "2012-03-29"))))))))
 
 (ert-deftest test-org/schedule ()
   "Test `org-schedule' specifications."
@@ -5990,15 +6022,17 @@ Paragraph<point>"
           (org-test-with-temp-text "* H"
             (let ((org-adapt-indentation nil)
                   (org-last-inserted-timestamp nil))
-              (org-test-without-dow 'buffer
-                (org-schedule nil "<2012-03-29 Tue>"))))))
+              (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-schedule nil "<2012-03-29 Tue>")))))))
   (should
    (equal "* H\nSCHEDULED: <2014-03-04>"
           (org-test-with-temp-text "* H\nSCHEDULED: <2012-03-29>"
             (let ((org-adapt-indentation nil)
                   (org-last-inserted-timestamp nil))
-              (org-test-without-dow 'buffer
-                (org-schedule nil "<2014-03-04 Thu>"))))))
+              (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-schedule nil "<2014-03-04 Thu>")))))))
   ;; Accept delta time, e.g., "+2d".
   (should
    (equal "* H\nSCHEDULED: <2015-03-04>"
@@ -6006,24 +6040,27 @@ Paragraph<point>"
             (org-test-with-temp-text "* H"
               (let ((org-adapt-indentation nil)
                     (org-last-inserted-timestamp nil))
-                (org-test-without-dow 'buffer
-                  (org-schedule nil "+1y")))))))
+                (org-test-without-dow
+                 (org-test-with-result 'buffer
+                   (org-schedule nil "+1y"))))))))
   ;; Preserve repeater.
   (should
    (equal "* H\nSCHEDULED: <2012-03-29 +2y>"
           (org-test-with-temp-text "* H"
             (let ((org-adapt-indentation nil)
                   (org-last-inserted-timestamp nil))
-              (org-test-without-dow 'buffer
-                (org-schedule nil "<2012-03-29 Tue +2y>"))))))
+              (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-schedule nil "<2012-03-29 Tue +2y>")))))))
   ;; Remove CLOSED keyword, if any.
   (should
    (equal "* H\nSCHEDULED: <2012-03-29>"
           (org-test-with-temp-text "* H\nCLOSED: [2017-01-25 Wed]"
             (let ((org-adapt-indentation nil)
                   (org-last-inserted-timestamp nil))
-              (org-test-without-dow 'buffer
-                (org-schedule nil "<2012-03-29 Tue>"))))))
+              (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-schedule nil "<2012-03-29 Tue>")))))))
   ;; With C-u argument, remove SCHEDULED keyword.
   (should
    (equal "* H\n"
@@ -6071,8 +6108,9 @@ Paragraph<point>"
               (transient-mark-mode 1)
               (push-mark (point) t t)
               (goto-char (point-max))
-              (org-test-without-dow 'buffer
-                (org-schedule nil "2012-03-29"))))))
+              (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-schedule nil "2012-03-29")))))))
   (should-not
    (equal "* H1\nSCHEDULED: <2012-03-29>\n* H2\nSCHEDULED: <2012-03-29>"
           (org-test-with-temp-text "* H1\n* H2"
@@ -6082,8 +6120,9 @@ Paragraph<point>"
               (transient-mark-mode 1)
               (push-mark (point) t t)
               (goto-char (point-max))
-              (org-test-without-dow 'buffer
-                (org-schedule nil "2012-03-29"))))))
+              (org-test-without-dow
+               (org-test-with-result 'buffer
+                 (org-schedule nil "2012-03-29")))))))
   (should
    ;; check if a repeater survives re-scheduling.
    (equal
@@ -6091,8 +6130,9 @@ Paragraph<point>"
     (org-test-with-temp-text "* H\nSCHEDULED: <2017-01-19 ++7d>\n"
       (let ((org-adapt-indentation nil)
             (org-last-inserted-timestamp nil))
-        (org-test-without-dow 'buffer
-          (org-schedule nil "2017-02-01")))))))
+        (org-test-without-dow
+         (org-test-with-result 'buffer
+           (org-schedule nil "2017-02-01"))))))))
 
 
 ;;; Property API



reply via email to

[Prev in Thread] Current Thread [Next in Thread]