* [PATCH] Add test checking org-log-done specs
@ 2021-07-11 6:04 Ihor Radchenko
2021-09-25 15:06 ` Bastien
0 siblings, 1 reply; 2+ messages in thread
From: Ihor Radchenko @ 2021-07-11 6:04 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 163 bytes --]
Hi,
I did not find any tests checking logging specifications of Org mode.
Attached is an example implementation of such test for org-log-done
specs.
Best,
Ihor
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-test-checking-org-log-done-specs.patch --]
[-- Type: text/x-diff, Size: 4381 bytes --]
From 2a58a82520de57142c6a397d811290f19789635f Mon Sep 17 00:00:00 2001
Message-Id: <2a58a82520de57142c6a397d811290f19789635f.1625983309.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Sun, 11 Jul 2021 13:38:07 +0800
Subject: [PATCH] Add test checking org-log-done specs
* testing/lisp/test-org.el (test-org/org-log-done): New test
---
testing/lisp/test-org.el | 126 +++++++++++++++++++++++++++++++++++++++
1 file changed, 126 insertions(+)
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index c2267c32d..6922cbb4f 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -7418,6 +7418,132 @@ (ert-deftest test-org/auto-repeat-maybe ()
(org-add-log-note))
(buffer-string))))))
+(ert-deftest test-org/org-log-done ()
+ "Test `org-log-done' specifications."
+ ;; nil value.
+ (should
+ (string=
+ "* DONE task"
+ (let ((org-log-done nil)
+ (org-todo-keywords '((sequence "TODO" "DONE"))))
+ (org-test-with-temp-text
+ "* TODO task"
+ (org-todo "DONE")
+ (when (memq 'org-add-log-note post-command-hook)
+ (org-add-log-note))
+ (buffer-string)))))
+ ;; `time' value.
+ (should
+ (string=
+ (format
+ "* DONE task
+CLOSED: %s"
+ (org-test-with-temp-text ""
+ (org-insert-time-stamp (current-time) t t)
+ (buffer-string)))
+ (let ((org-log-done 'time)
+ (org-log-done-with-time t)
+ (org-todo-keywords '((sequence "TODO" "DONE"))))
+ (org-test-with-temp-text
+ "* TODO task"
+ (org-todo "DONE")
+ (when (memq 'org-add-log-note post-command-hook)
+ (org-add-log-note))
+ (buffer-string)))))
+ (should
+ (string=
+ (format
+ "* DONE task
+CLOSED: %s"
+ (org-test-with-temp-text ""
+ (org-insert-time-stamp (current-time) nil t)
+ (buffer-string)))
+ (let ((org-log-done 'time)
+ (org-log-done-with-time nil)
+ (org-todo-keywords '((sequence "TODO" "DONE"))))
+ (org-test-with-temp-text
+ "* TODO task"
+ (org-todo "DONE")
+ (when (memq 'org-add-log-note post-command-hook)
+ (org-add-log-note))
+ (buffer-string)))))
+ ;; TODO: Test `note' value.
+ ;; Test startup overrides.
+ (should
+ (string=
+ "#+STARTUP: nologdone
+* DONE task"
+ (let ((org-log-done 'time)
+ (org-todo-keywords '((sequence "TODO" "DONE"))))
+ (org-test-with-temp-text
+ "#+STARTUP: nologdone
+<point>* TODO task"
+ (org-set-regexps-and-options)
+ (org-todo "DONE")
+ (when (memq 'org-add-log-note post-command-hook)
+ (org-add-log-note))
+ (buffer-string)))))
+ (should
+ (string=
+ (format
+ "#+STARTUP: logdone
+* DONE task
+CLOSED: %s"
+ (org-test-with-temp-text ""
+ (org-insert-time-stamp (current-time) t t)
+ (buffer-string)))
+ (let ((org-log-done nil)
+ (org-log-done-with-time t)
+ (org-todo-keywords '((sequence "TODO" "DONE"))))
+ (org-test-with-temp-text
+ "#+STARTUP: logdone
+<point>* TODO task"
+ (org-set-regexps-and-options)
+ (org-todo "DONE")
+ (when (memq 'org-add-log-note post-command-hook)
+ (org-add-log-note))
+ (buffer-string)))))
+ ;; Test local property overrides.
+ (should
+ (string=
+ "* DONE task
+:PROPERTIES:
+:LOGGING: nil
+:END:"
+ (let ((org-log-done 'time)
+ (org-todo-keywords '((sequence "TODO" "DONE"))))
+ (org-test-with-temp-text
+ "* TODO task
+:PROPERTIES:
+:LOGGING: nil
+:END:"
+ (org-todo "DONE")
+ (when (memq 'org-add-log-note post-command-hook)
+ (org-add-log-note))
+ (buffer-string)))))
+ (should
+ (string=
+ (format
+ "* DONE task
+CLOSED: %s
+:PROPERTIES:
+:LOGGING: logdone
+:END:"
+ (org-test-with-temp-text ""
+ (org-insert-time-stamp (current-time) t t)
+ (buffer-string)))
+ (let ((org-log-done nil)
+ (org-log-done-with-time t)
+ (org-todo-keywords '((sequence "TODO" "DONE"))))
+ (org-test-with-temp-text
+ "* TODO task
+:PROPERTIES:
+:LOGGING: logdone
+:END:"
+ (org-todo "DONE")
+ (when (memq 'org-add-log-note post-command-hook)
+ (org-add-log-note))
+ (buffer-string))))))
\f
;;; Timestamps API
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-09-25 15:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-11 6:04 [PATCH] Add test checking org-log-done specs Ihor Radchenko
2021-09-25 15:06 ` Bastien
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).