Making perl unit tests easier to run in emacs

It's a hassle to have to switch from emacs to the shell, run unit tests, pick out the failure, switch back to emacs, navigate to the line, forget where you were supposed to go, switch back, etc etc.

The whole process is much easier with compilation-perl.el. This handy bit of code sets up patterns for compilation-mode so that test failures (among other things) are recognized. Just add compilation-perl.el to your emacs lisp directory and follow the directions at the top of the file for installation instructions.

So my test process is now:

  1. Hit F4 (which I have mapped to compile).
  2. If necessary, change the command to either make test or to run a specific test I'm working on (e.g. perl t/MyModule.t).
  3. If there's a failure, press C-F4 (which I have mapped to next-error) and it brings me right to the failure.
  4. Repeat from step 1 (but the second time around I don't need to do step 2 since the command is already set properly).

Posted on 2011-07-07 by brian in tools .
Comments on this post are closed. If you have something to share, please send me email.