emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nondeterministic org-test-with-temp-text?


From: Nicolas Goaziou
Subject: Re: nondeterministic org-test-with-temp-text?
Date: Sat, 30 May 2020 18:09:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]