Fix file / line reporting for lazy defn loading, fixes #11.

This commit is contained in:
Colin Jones 2011-04-19 09:00:59 -05:00
parent 99eb97266c
commit ff7623f2ad

View File

@ -1,7 +1,8 @@
(ns path-to-enlightenment (ns path-to-enlightenment
(:use [clojure.test]) (:use [clojure.test])
(:require [clojure.set] (:require [clojure.set]
[clojure.string])) [clojure.string]
[clojure.test]))
(def __ :fill-in-the-blank) (def __ :fill-in-the-blank)
(def ___ (fn [& args] __)) (def ___ (fn [& args] __))
@ -10,14 +11,16 @@
(System/exit 0)) (System/exit 0))
(defmacro meditations [& forms] (defmacro meditations [& forms]
(let [pairs (partition 2 forms)] (let [pairs (partition 2 forms)
`(do pairs (conj pairs
~@(map ["Bootstrap for file/line reporting"
(fn [[doc# code#]] '(clojure.test/is (= 0 0))])
`(if (is ~code# ~doc#) tests (map (fn [[doc# code#]]
:pass `(if (is ~code# ~doc#)
(handle-problem))) :pass
pairs)))) (handle-problem)))
pairs)]
`(do ~@tests)))
(def ordered-koans (def ordered-koans
["equalities" ["equalities"
@ -62,5 +65,5 @@
(defn run [] (defn run []
(require-version (parse-required-version)) (require-version (parse-required-version))
(apply load (doall (map (partial str "koans/") ordered-koans))) (doall (map (comp load (partial str "koans/")) ordered-koans))
(println "You have achieved clojure enlightenment. Namaste.")) (println "You have achieved clojure enlightenment. Namaste."))