clojure-koans/koans/path_to_enlightenment.clj

18 lines
528 B
Clojure
Raw Normal View History

(load "about-asserts")
(defmacro meditate-on
"Runs tests but exits if an assertion fails"
[test-function]
`(try
(~test-function)
(catch Throwable t#
(println (str (:zen (meta #'~test-function)) "\n"
(:name (meta #'~test-function))
" returned " t#))
(System/exit 1))))
(meditate-on test-truth)
(meditate-on test-assert-equality)
2010-01-31 16:52:32 +00:00
(meditate-on test-fill-in-values)
(println "You have achieved clojure zen. Go out into the universe and spread your newfound knowledge.")