emacs-orgmode
[Top][All Lists]
Advanced

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

[PATCH] rfc: using ert-deftest with side-effects


From: Leo Butler
Subject: [PATCH] rfc: using ert-deftest with side-effects
Date: Mon, 7 Nov 2022 17:03:02 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hello,

I am patching a bug in ob-octave.el (see attachment) involving the
creation of graphics files. The bug itself is easy to fix: a single line
in ob-octave.el ensures the special variable `ans' is bound, to prevent
Octave from exiting with a non-zero exit code.

However, I would like feedback/suggestions on writing such a
test. Issues include:

1. how to clean up the side-effects, including changes in the test
   buffer, filesystem and potentially creating an error buffer;
2. the general absence of similar tests (except in test-ob.el,
   test-ob/result-graphics-link-type-header-argument).

To address 1., I have wrapped the tests in an `unwind-protect' form to
ensure clean-up code gets run. The ERT manual does not suggest much
beyond this. At the moment, when the test is run, clean-up is being done
whether the test fails or passes.

I am unsure about 2. Is the absence of such tests because there is a
policy against them, or ...

Leo

Attachment: 0001-On-ltb-ob-max-ob-octave.patch
Description: 0001-On-ltb-ob-max-ob-octave.patch


reply via email to

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