[Top][All Lists]

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

Unit testing Emacs Lisp

From: Phil Hagelberg
Subject: Unit testing Emacs Lisp
Date: Sun, 15 Jul 2007 16:36:16 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

I've been developing a few miscellaneous modes for Emacs Lisp for a
while now, and I've always felt a bit uncomfortable about the lack of
tests for my modes. I usually write test-driven code in other
languages, and writing code without automated testing is somewhat of
an anathema to me; I like to be able to know immediately when my
changes have broken things.

Anyhow, I've been playing with unit testing Elisp for a while and have
gone through a number of incarnations of test frameworks, but none of
them have really been convenient enough to get me to use them on a
regular basis.

With that in mind, I'm trying to gather input on what would make a
good unit testing framework for Elisp. The gist is that it would be
loosely based on xUnit, with tests divided up into suites. Each test
is stored as a lambda that contains setup code and a number of
assertions that prove the code did what it was supposed to do. Rather
than executing the tests when the code is evaled, they are stored in
memory to be run by a separate interactive command.

What is equally or more important is the helper functions that would
accompany such a framework. I find that in my own tests the bulk of
the work is in setting up buffers and getting things to the point
where I can perform checks on behaviour; I believe a few functions for
abstractions for those types of tasks could go a long way towards
making things easier.

I've begun a brainstorm on the Emacs Wiki:

Comments (either on the wiki or on the list) would be appreciated.


-Phil Hagelberg

reply via email to

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