ADD tests for periodicals

This commit is contained in:
Nathan Dwarshuis 2021-04-11 00:05:49 -04:00
parent 0b451e7891
commit 34d578045d
1 changed files with 41 additions and 5 deletions

View File

@ -31,14 +31,14 @@
(float-time) (float-time)
(round)))) (round))))
(defun org-x-gen-ts (offset) (defun org-x-gen-ts (offset &optional active)
"Generate an org timestamp string. "Generate an org timestamp string.
OFFSET is the length of time from now in seconds (positive is in OFFSET is the length of time from now in seconds (positive is in
the future)." the future). Make an active timestamp if ACTIVE is t."
(->> (float-time) (-> (float-time)
(+ offset) (+ offset)
(org-ml-unixtime-to-time-long) (org-ml-unixtime-to-time-long)
(org-ml-build-timestamp!) (org-ml-build-timestamp! :active active)
(org-ml-to-string))) (org-ml-to-string)))
(defun org-x-test-parse-forms (s) (defun org-x-test-parse-forms (s)
@ -391,5 +391,41 @@ Forms are denoted like %(FORM)%."
"SCHEDULED: %(org-x-gen-ts (1+ org-clone-iter-future-time))%") "SCHEDULED: %(org-x-gen-ts (1+ org-clone-iter-future-time))%")
=> :project-error) => :project-error)
(org-x--test-buffer-strings "Periodical status"
(org-x-get-periodical-status)
"uninitialized"
("* periodical"
":PROPERTIES:"
":PARENT_TYPE: periodical"
":END:")
=> :uninit
"empty"
("* periodical"
":PROPERTIES:"
":PARENT_TYPE: periodical"
":END:"
"** sub"
"%(org-x-gen-ts 0 t)%")
=> :empt
"active"
("* periodical"
":PROPERTIES:"
":PARENT_TYPE: periodical"
":END:"
"** sub"
"%(org-x-gen-ts (+ (* 60 60 24) org-clone-peri-future-time) t)%")
=> :actv
"unscheduled"
("* periodical"
":PROPERTIES:"
":PARENT_TYPE: periodical"
":END:"
"** sub")
=> :unscheduled)
(provide 'org-x-test-buffer-state) (provide 'org-x-test-buffer-state)
;;; org-x-test-buffer-state.el ends here ;;; org-x-test-buffer-state.el ends here