-
Notifications
You must be signed in to change notification settings - Fork 129
Midje mode
Midje-mode is an Emacs minor mode that aims to provide a tight feedback loop between writing tests ("facts") and the code that passes them. It tries to conserve your attention by putting facts, code, and output of the interpreter all in the same buffer.
To use midje-mode, put the contents of the download somewhere where your emacs can find it. Or, if you use el-get, just add midje-mode
to your el-get-sources
.
Here's a sample of what you might add to your .emacs
file:
(require 'clojure-mode)
(add-to-list 'auto-mode-alist '("\\.clj$" . clojure-mode))
(require 'midje-mode)
(add-hook 'clojure-mode-hook 'midje-mode)
Keys (see also C-h f midje-mode)
-
C-c ,
Within a fact, this sends the fact to the REPL and inserts the results just above the fact.
Within a defn, this compiles the defn and then rechecks the last-checked fact.
-
C-c u
Outside the (unfinished) list, this adds the identifier near the cursor to that list. The identifier is also declared to the REPL.
Within the (unfinished) list, this removes the identifier near the cursor and creates a defn and fact for it. The skeletal defn is sent to the repl, so that you can immediately check the fact to see it fail.
-
C-c k
Checking a fact inserts comments into the current buffer. This deletes all such comments.
-
C-c h, C-c s
The first form "hides" all facts by condensing them down to a single line. The second expands them all.
-
C-c f
This "focuses" your attention on a single fact by hiding all other facts.