Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
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.
Here's a sample of what you might add to your
(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)
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.
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.
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.
This "focuses" your attention on a single fact by hiding all other facts.