[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 1b05e1e 131/135: Fixed failing tests
From: |
Ian Dunn |
Subject: |
[elpa] master 1b05e1e 131/135: Fixed failing tests |
Date: |
Mon, 17 Feb 2020 10:53:06 -0500 (EST) |
branch: master
commit 1b05e1e2b6b5c66b4fad338dc94ddc6605cde5b9
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>
Fixed failing tests
* org-edna-tests.el (org-test-at-time): Added to keep up with org mode
changes.
(org-edna-test-setup): Use it.
---
org-edna-tests.el | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
org-edna.el | 4 ++--
2 files changed, 58 insertions(+), 5 deletions(-)
diff --git a/org-edna-tests.el b/org-edna-tests.el
index c877321..d044e3d 100644
--- a/org-edna-tests.el
+++ b/org-edna-tests.el
@@ -76,12 +76,65 @@
;; Change the test file back to its original state.
(org-edna-test-restore-test-file)))
+;; Copied from org-test.el in `org-mode' source code.
+(defmacro org-test-at-time (time &rest body)
+ "Run body while pretending that the current time is TIME.
+TIME can be a non-nil Lisp time value, or a string specifying a date and time."
+ (declare (indent 1))
+ (let ((tm (cl-gensym))
+ (at (cl-gensym)))
+ `(let* ((,tm ,time)
+ (,at (if (stringp ,tm)
+ (apply #'encode-time (org-parse-time-string ,tm))
+ ,tm)))
+ (cl-letf
+ ;; Wrap builtins whose behavior can depend on the current time.
+ (((symbol-function 'current-time)
+ (lambda () ,at))
+ ((symbol-function 'current-time-string)
+ (lambda (&optional time &rest args)
+ (apply ,(symbol-function 'current-time-string)
+ (or time ,at) args)))
+ ((symbol-function 'current-time-zone)
+ (lambda (&optional time &rest args)
+ (apply ,(symbol-function 'current-time-zone)
+ (or time ,at) args)))
+ ((symbol-function 'decode-time)
+ (lambda (&optional time) (funcall ,(symbol-function 'decode-time)
+ (or time ,at))))
+ ((symbol-function 'encode-time)
+ (lambda (time &rest args)
+ (apply ,(symbol-function 'encode-time) (or time ,at) args)))
+ ((symbol-function 'float-time)
+ (lambda (&optional time)
+ (funcall ,(symbol-function 'float-time) (or time ,at))))
+ ((symbol-function 'format-time-string)
+ (lambda (format &optional time &rest args)
+ (apply ,(symbol-function 'format-time-string)
+ format (or time ,at) args)))
+ ((symbol-function 'set-file-times)
+ (lambda (file &optional time)
+ (funcall ,(symbol-function 'set-file-times) file (or time ,at))))
+ ((symbol-function 'time-add)
+ (lambda (a b) (funcall ,(symbol-function 'time-add)
+ (or a ,at) (or b ,at))))
+ ((symbol-function 'time-equal-p)
+ (lambda (a b) (funcall ,(symbol-function 'time-equal-p)
+ (or a ,at) (or b ,at))))
+ ((symbol-function 'time-less-p)
+ (lambda (a b) (funcall ,(symbol-function 'time-less-p)
+ (or a ,at) (or b ,at))))
+ ((symbol-function 'time-subtract)
+ (lambda (a b) (funcall ,(symbol-function 'time-subtract)
+ (or a ,at) (or b ,at)))))
+ ,@body))))
+
(defmacro org-edna-test-setup (&rest body)
"Common settings for tests."
(declare (indent 0))
;; Override `current-time' so we can get a deterministic value
- `(cl-letf* (((symbol-function 'current-time) (lambda () org-edna-test-time))
- ;; Only use the test file in the agenda
+ `(org-test-at-time org-edna-test-time
+ (let* (;; Only use the test file in the agenda
(org-agenda-files `(,org-edna-test-file))
;; Ensure interactive modification of TODO states works.
(org-todo-keywords '((sequence "TODO" "|" "DONE")))
@@ -91,7 +144,7 @@
(org-trigger-hook 'org-edna-trigger-function)
;; Inhibit messages if indicated
(inhibit-message org-edna-test-inhibit-messages))
- ,@body))
+ ,@body)))
(defmacro org-edna-with-point-at-test-heading (heading-id &rest body)
(declare (indent 1))
diff --git a/org-edna.el b/org-edna.el
index 1cdc52b..38aff93 100644
--- a/org-edna.el
+++ b/org-edna.el
@@ -971,8 +971,8 @@ All arguments are symbols, unless noted otherwise.
('step-down
(setq targets
(org-with-wide-buffer
- (org-goto-first-child)
- (org-edna-collect-current-level (org-edna-self-marker) nil nil
t))))
+ (when (org-goto-first-child)
+ (org-edna-collect-current-level (org-edna-self-marker) nil
nil t)))))
('todo-only
;; Remove any entry without a TODO keyword, or with a DONE keyword
(cl-pushnew
- [elpa] master f45f911 115/135: Mention consider in opening of Consideration section, (continued)
- [elpa] master f45f911 115/135: Mention consider in opening of Consideration section, Ian Dunn, 2020/02/17
- [elpa] master c4d1298 099/135: Added new forms for set-property! and fixed up build system, Ian Dunn, 2020/02/17
- [elpa] master 5cacf20 078/135: Updated documentation, Ian Dunn, 2020/02/17
- [elpa] master bad787d 128/135: Bumped version, Ian Dunn, 2020/02/17
- [elpa] master 6869846 130/135: Merged fix., Ian Dunn, 2020/02/17
- [elpa] master c50f484 106/135: Implemented finder cache, Ian Dunn, 2020/02/17
- [elpa] master 4142fb8 108/135: Updated tests for new form expansion, Ian Dunn, 2020/02/17
- [elpa] master 2354cde 118/135: Fixed up description of set-effort!., Ian Dunn, 2020/02/17
- [elpa] master 97b6600 119/135: Additional tests and minor cleanup, Ian Dunn, 2020/02/17
- [elpa] master 94edf14 120/135: Added timestamp sorting to relatives finder, Ian Dunn, 2020/02/17
- [elpa] master 1b05e1e 131/135: Fixed failing tests,
Ian Dunn <=
- [elpa] master 3647cf7 095/135: Overhauled parsing method, and added conditional blocks, Ian Dunn, 2020/02/17
- [elpa] master 6e1f5fb 087/135: Fixed bug in planning action, Ian Dunn, 2020/02/17
- [elpa] master 2e8b7eb 094/135: Don't export special strings for documentation, Ian Dunn, 2020/02/17
- [elpa] master a3183b2 105/135: Bumped version, Ian Dunn, 2020/02/17
- [elpa] master a2da465 107/135: Bumped version, Ian Dunn, 2020/02/17
- [elpa] master b72cb7b 101/135: Cleaned up Changelog some more, Ian Dunn, 2020/02/17
- [elpa] master 6b3923b 110/135: Added tests for cache, Ian Dunn, 2020/02/17
- [elpa] master 4c8058f 129/135: Step down should not include the headline itself when it has no children., Ian Dunn, 2020/02/17
- [elpa] master 1d8bf6e 127/135: Fixed timestamp bug in scheduled! and deadline! actions, Ian Dunn, 2020/02/17
- [elpa] master e6ba769 134/135: Temporarily removed Org Edna directory, Ian Dunn, 2020/02/17