clojure-expectations/clojure-test

Maybe document with-test?

seancorfield opened this issue · 0 comments

clojure.test/with-test allows tests to be defined around a function definition. I've never seen anyone do this but it does work with expectations too:

(with-test 
  (defn foobar [x] 
    (* 2 x)) 
  (expect 4 (foobar 2)) 
  (expect even? (foobar 13)))
(foobar 1) ;=> 2
(test-vars [#'foobar]) ; runs the tests