Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unit testing Clojure on the fly in a separate frame

I was watching an amazing "Emacs rocks" video and I noticed that the developers were using two windows side by side where one window is Emacs and the other window is used to (nearly) constantly run unit tests. The video is here (it's really good looking IMO):

http://www.youtube.com/watch?v=Zxt-c_N82_w

How can I do the same when working with Clojure?

What I'd would like to see on screen would be:

  • the .clj file I'm currently editing in a buffer
  • one REPL
  • one other window (an Emacs frame?) where I could see the results of my unit tests (the unit tests themselves being defined either inside each .clj file they test or in separate .clj files, I don't care)

Ideally I'd like to have the results of the unit tests shown in another Emacs frame but a regular terminal would do too (as long as there's at least some color support).

Is anyone doing anything similar? I don't mind shell scripting or elisp'ing or anything else as long as it allows to get a similar setup to unit tests Clojure code.

like image 532
Cedric Martin Avatar asked Jul 02 '12 15:07

Cedric Martin


1 Answers

If you add lein autotest plugin

  • Ctrl-x 2 to split the pane horizontally
  • Ctrl-x 3 to split the top panel into code and test
  • clojure-jack-in to put the repl in the bottom buffer
  • M-x ansi-term in one of the top panels to get a decent terminal then run lein autotest in that terminal.
like image 111
Arthur Ulfeldt Avatar answered Nov 20 '22 19:11

Arthur Ulfeldt