I've attached a screenshot of it in action. Basically it colors failing
"is" forms in red and erroring forms in brown. When you put the point in
a failing "is" form and press C-c ', it will show the failure message in
the minibuffer.
I find it to be very useful when writing tests to be able to get instant
feedback. And if it's easier to write tests, hopefully that means more
tests will get written. =)
Please try it out if you use SLIME and let me know how it works for
you. One serious caveat is that swank-clojure hasn't been updated to
work with clojure-trunk yet, so you'll need to use slightly older
versions of everything. Here's what I've got:
Clojure: git://github.com/kevinoneill/clojure.git revision d866f14
Contrib: git://github.com/technomancy/clojure-contrib.git revision 4802d99
Swank-clojure: git://github.com/jochu/swank-clojure.git revision 581954d
SLIME: git://github.com/nablaone/slime.git revision 5b8cb89
Hopefully the dust will settle soon, but for you've got to step lightly.
-Phil
- I added the clojure-test initialization code to ~/.emacs right after
setting up clojure-mode
- When loading a .clj file in Emacs, it automatically triggers Slime
- However, the file is not actually loaded; I had to C-c C-l
- C-c C-' is not bound; if I (run-tests 'clojure-mode.test-is), the
tests run but nothing appears in the editor window
Any idea what could be wrong? Here's the clojure-mode /
clojure-test-mode part of ~/.emacs
(autoload 'clojure-mode "clojure-mode" "A major mode for Clojure" t)
(add-to-list 'auto-mode-alist '("\\.clj$" . clojure-mode))
(autoload 'clojure-test-mode "clojure-test-mode" "Clojure test mode" t)
(add-hook 'clojure-mode-hook
(lambda () (save-excursion
(goto-char (point-min))
(if (or (search-forward "(deftest" nil t)
(search-forward "(with-test" nil t))
(clojure-test-mode t)))))
Thanks,
--
miʃel salim • http://hircus.jaiku.com/
IUCS • msa...@cs.indiana.edu
Fedora • sal...@fedoraproject.org
MacPorts • hir...@macports.org
> That would be really neat! I'm having a bit of trouble setting it up,
> though:
> - When loading a .clj file in Emacs, it automatically triggers Slime
This should happen only on test files, not every clojure file.
> - However, the file is not actually loaded; I had to C-c C-l
Right; it doesn't load until you call clojure-test-run-tests, which is
bound to C-c C-,.
> - C-c C-' is not bound; if I (run-tests 'clojure-mode.test-is), the
> tests run but nothing appears in the editor window
C-c C-' is not bound; it should be C-c ' without control on the
quote. This should be called after you've run the tests to see the
details of the failure/error at point.
> Any idea what could be wrong? Here's the clojure-mode /
> clojure-test-mode part of ~/.emacs
Does "Test" show up in the modeline in your test buffers? If so then the
mode is activated correctly. I'm still working through some bugs that
surface unpredictably due to the asynchronous nature of SLIME, so if you
don't see anything be sure to try C-c C-, a number of times.
-Phil