A Short Tutorial on ERT

Abrochard has an excellent short tutorial on using ERT for running regression tests on your Elisp code. Most of us, of course, don’t write enough Elisp to worry about regression tests but if you want to contribute to Emacs or an Emacs related project, it’s worth spending a couple of minutes learning about ERT.

It’s really easy to specify a test. In the simplest case you simply make one or more statements of the form

(should (equal <expected value> (<tested-function> <function-parameters>)))

and call ERT.

ERT can handle more complicated cases, including those that don’t return a value. Abrochard has a nice example of how to mock up a test when a function doesn’t return a value. Take a look at his post to see the particulars. There’s even more information in the ERT manual so take a look at that too. It’s really easy to use and there’s no reason not to take advantage of it.

This entry was posted in General and tagged . Bookmark the permalink.