TDD and SLIME
I’ve finally gotten used to the rhythm of test-first development. It took me a while to get here, but now, I wouldn’t dream of writing code without tests.
Even though there are plenty of test frameworks available for Common Lisp, no one has bothered connecting one with SLIME. Personally, I find that very odd since unit tests are meant to be run often. The test suite should evolve at the same pace as the rest of the code base.
For my code, I use Lisp-unit and since I don’t want to have to switch back and forth between code buffers and the REPL just to invoke
(lisp-unit:run-all-tests <package>). I decided to write some Emacs Lisp glue to bind the key sequence C-t C-a to lisp-unit’s run-all-tests function. It’s still very rough around the edges, but it works. You can find the code on GitHub.
To install, place the file slime-lispunit.el in your slime/contrib/ directory and update your .emacs to include slime-lispunit in the call to slime-setup.
[Update 2010-03-25] I’ve made some minor improvements of the code. Most importantly, pressing C-t C-a now behaves as if you’ve typed
(lisp-unit:run-all-tests <package>) in the REPL.