emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Allen Li <darkfeline@felesatra.moe>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] org-todo (C-c C-t) bad negative prefix behavior [9.5.2 (9.5.2-gfbff08 @ /home/ionasal/.emacs.d/elpa/org-9.5.2/)]
Date: Sat, 25 Jun 2022 22:41:05 -0700	[thread overview]
Message-ID: <CADbSrJz19oDiGL59FnVoNufVLjx9bvho0o0xpnGUuJ0fvOb=yQ@mail.gmail.com> (raw)
In-Reply-To: <87zgi02fml.fsf@localhost>


[-- Attachment #1.1: Type: text/plain, Size: 891 bytes --]

Attached

On Sat, Jun 25, 2022 at 9:48 PM Ihor Radchenko <yantar92@gmail.com> wrote:

> Allen Li <darkfeline@felesatra.moe> writes:
>
> >> Would you also be interested to write a test checking org-todo ARGS?
> >>
> >
> > Attached
>
> Thanks! However, it is unclear what this test is checking for.
>
> > +(ert-deftest test-org/org-todo-prefix ()
> > +  "Test `org-todo' prefix arg behavior."
> > +  ;; -1 prefix arg should cancel repeater and mark DONE.
> > +  (should-not
> > +   (string-prefix-p
> > +    "* TODO H"
> > +    (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)))))
>
> This test does not check if the task is actually marked DONE and also
> does not check if the repeater is canceled.
>
> Best,
> Ihor
>
>

[-- Attachment #1.2: Type: text/html, Size: 1409 bytes --]

[-- Attachment #2: 0001-test-org-Add-test-for-org-todo-prefix-behavior.patch --]
[-- Type: text/x-patch, Size: 1351 bytes --]

From 42156ba1e8b3c589394212ef423f99e122544c5f Mon Sep 17 00:00:00 2001
From: Allen Li <darkfeline@felesatra.moe>
Date: Sat, 25 Jun 2022 21:27:20 -0700
Subject: [PATCH] test-org: Add test for org-todo prefix behavior

* testing/lisp/test-org.el (test-org/org-todo-prefix): Add test.
---
 testing/lisp/test-org.el | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 121f9efd5..d686c0e3b 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -7753,6 +7753,25 @@ CLOSED: %s
           (org-add-log-note))
         (buffer-string))))))
 
+(ert-deftest test-org/org-todo-prefix ()
+  "Test `org-todo' prefix arg behavior."
+  ;; -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))))))
+
 \f
 ;;; Timestamps API
 
-- 
2.36.1


  reply	other threads:[~2022-06-26  5:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-01  9:31 Allen Li
2022-01-01  9:44 ` Allen Li
2022-02-07 14:11   ` Ihor Radchenko
2022-06-18  6:10     ` Ihor Radchenko
2022-06-26  4:30       ` Allen Li
2022-06-26  4:49         ` Ihor Radchenko
2022-06-26  5:41           ` Allen Li [this message]
2022-06-26  6:31             ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADbSrJz19oDiGL59FnVoNufVLjx9bvho0o0xpnGUuJ0fvOb=yQ@mail.gmail.com' \
    --to=darkfeline@felesatra.moe \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@gmail.com \
    --subject='Re: [BUG] org-todo (C-c C-t) bad negative prefix behavior [9.5.2 (9.5.2-gfbff08 @ /home/ionasal/.emacs.d/elpa/org-9.5.2/)]' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this 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).