* Testing a command
@ 2008-08-16 1:18 Lennart Borgman (gmail)
0 siblings, 0 replies; only message in thread
From: Lennart Borgman (gmail) @ 2008-08-16 1:18 UTC (permalink / raw)
To: Emacs Devel, Phil Hagelberg, Christian Ohler
As I have mentioned I am (with due help of Christian and Phil) trying to
write some test scripts for nXhtml and MuMaMo. This scripts uses ert.el.
One thing that come to my mind is that I do not actually really know how
to test an Emacs command function. And in the case of MuMaMo where I
want to test the fontification it is a little bit more complicated.
However I would like some suggestions for a general pattern for testing
a command. There is not much to say about the command itself, but I
might miss things about hooks and timers.
* Which hooks are always involved? Is there any other than
before-change-functions, after-change-functions, pre-command-hook and
post-command-hook?
* I guess that before-change-functions and after-change-functions are
run immediately at each separate buffer change in a command so that
there is nothing extra to do during testing. Is this correct?
* Is there any general way to test for errors that happened during the
execution of these hooks?
* For pre-command-hook and post-command-hook I guess you can just run
them with run-hooks and check for errors as usual. Is that correct?
* How should the idle timers be handled? Is it ok to do it like this
(after a suggestion from Christian, the bad function name is mine):
(defun nxhtmltest-fontify-w-timers-handlers ()
(dolist (timer (copy-list timer-idle-list))
(timer-event-handler timer))
(redisplay t))
The pattern for testing a command then to me looks something like this
- Setup for testing
- Call the pre-command-hook (with error checking)
- Check any log buffers
- Call the command function (with error checking)
- Check any log buffers
- Check for after/before-change-hook errors
- Call post-command-hook (with error checking)
- Check any log buffers
- Call idle timers (with error checking)
- Check any log buffers
- Check the result
Does any one have comments or suggestions about this? (One difficulty I
can see is that the idle timers maybe should not always be run, but I
have no good idea about how to handle this. It is a stochastic problem.)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-08-16 1:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-16 1:18 Testing a command Lennart Borgman (gmail)
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.