From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Kevin Liu <kevin@nivekuil.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: nondeterministic org-test-with-temp-text?
Date: Sat, 30 May 2020 18:09:58 +0200 [thread overview]
Message-ID: <87v9kdmmjt.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <874krxpmgu.fsf@nivekuil.com> (Kevin Liu's message of "Sat, 30 May 2020 06:43:29 -0700")
Hello,
Kevin Liu <kevin@nivekuil.com> writes:
> I’m trying to add a test (which should fail at the moment, representing
> an org-mode bug), but it seems like each ‘should’ form is actually
> nondeterministic. The first form returns nil on the first eval and t on
> subsequent evals, its behavior resetting upon any command, and the
> second form does the inverse, returning t on the first eval and nil on
> subsequent evals.
>
> Is this behavior expected?
>
> (ert-deftest test-org/org-next-visible-heading ()
> (should
> (org-test-with-temp-text "* A\n** B\n\n\n* C"
> (org-overview)
> (org-cycle)
> (org-cycle)
> (org-next-visible-heading 1)
> (and (bolp) (org-at-heading-p))))
You cannot call `org-cycle' consecutively without care, because it
checks `last-command' and `this-command'. You need to fake their values
before calling `org-cycle' again.
Regards,
--
Nicolas Goaziou
next prev parent reply other threads:[~2020-05-30 16:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-30 13:43 nondeterministic org-test-with-temp-text? Kevin Liu
2020-05-30 16:09 ` Nicolas Goaziou [this message]
2020-05-31 1:52 ` Kevin Liu
2020-05-31 11:09 ` Nicolas Goaziou
2020-06-03 16:27 ` Kevin Liu
2020-06-03 16:31 ` Kevin Liu
2020-06-03 22:26 ` Nicolas Goaziou
2020-06-03 23:08 ` Kevin Liu
2020-06-04 14:10 ` Nicolas Goaziou
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=87v9kdmmjt.fsf@nicolasgoaziou.fr \
--to=mail@nicolasgoaziou.fr \
--cc=emacs-orgmode@gnu.org \
--cc=kevin@nivekuil.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).