Browse Source

test-org: Add test for org-todo prefix behavior

* testing/lisp/test-org.el (test-org/org-todo-prefix): Add test.
Allen Li 2 years ago
parent
commit
711ada5acd
1 changed files with 20 additions and 0 deletions
  1. 20 0
      testing/lisp/test-org.el

+ 20 - 0
testing/lisp/test-org.el

@@ -7753,6 +7753,26 @@ CLOSED: %s
           (org-add-log-note))
         (buffer-string))))))
 
+(ert-deftest test-org/org-todo-prefix ()
+  "Test `org-todo' prefix arg behavior."
+  ;; FIXME: Add tests for all other allowed prefix arguments.
+  ;; -1 prefix arg should cancel repeater and mark DONE.
+  (should
+   (string-match-p
+    "DONE H\\(.*\n\\)*<2012-03-29 Thu \\+0y>"
+    (let ((org-todo-keywords '((sequence "TODO" "DONE"))))
+      (org-test-with-temp-text "* TODO H\n<2012-03-29 Thu +2y>"
+	(org-todo -1)
+	(buffer-string)))))
+  ;; - prefix arg should cancel repeater and mark DONE.
+  (should
+   (string-match-p
+    "DONE H\\(.*\n\\)*<2012-03-29 Thu \\+0y>"
+    (let ((org-todo-keywords '((sequence "TODO" "DONE"))))
+      (org-test-with-temp-text "* TODO H\n<2012-03-29 Thu +2y>"
+	(org-todo '-)
+	(buffer-string))))))
+
 
 ;;; Timestamps API