Remove clojure.test dependencies

This commit is contained in:
Colin Jones 2011-06-10 22:22:04 -05:00
parent 5a5f519fb8
commit e6174d80dc
3 changed files with 27 additions and 20 deletions

View File

@ -1,8 +1,7 @@
(ns path-to-answer-sheet
(:use [runner.koans :only [ordered-koans]]
[path-to-enlightenment :only [meditations __ ___]]
[clojure.string :only [join split trim]]
[clojure.test :only [*test-out*]]))
[clojure.string :only [join split trim]]))
(def answers
{"equalities" {"__" [true
@ -216,17 +215,23 @@
(println (str "\n" koan ".clj is passing without filling in the blanks")))
(defn ensure-failing-without-answers []
(binding [clojure.test/*test-out*
(java.io.PrintWriter. (java.io.ByteArrayOutputStream.))]
(if (every?
(fn [koan]
(let [form (koan-text koan)
result (load-string form)]
(if result
(print-non-failing-error koan)
:pass)))
ordered-koans)
(println "\nTests all fail before the answers are filled in."))))
(if (every?
(fn [koan]
(let [form (koan-text koan)
fake-err (java.io.PrintStream. (java.io.ByteArrayOutputStream.))
real-err System/err
result (try
(System/setErr fake-err)
(load-string form)
true
(catch AssertionError e false)
(catch Exception e false)
(finally (System/setErr real-err)))]
(if result
(print-non-failing-error koan)
:pass)))
ordered-koans)
(println "\nTests all fail before the answers are filled in.")))
(defn ensure-passing-with-answers []
(try

View File

@ -1,18 +1,15 @@
(ns path-to-enlightenment
(:use [runner.freshness :only [setup-freshener]])
(:require [clojure.set]
[clojure.string]
[clojure.test]))
[clojure.string]))
(def __ :fill-in-the-blank)
(def ___ (fn [& args] __))
(defmacro meditations [& forms]
(let [pairs (conj (partition 2 forms)
["Bootstrap for file/line reporting"
'(clojure.test/is (= 0 0))])
(let [pairs (partition 2 forms)
tests (map (fn [[doc# code#]]
`(clojure.test/is ~code# ~doc#))
`(assert ~code# ~doc#))
pairs)]
`(and ~@tests)))

View File

@ -42,7 +42,12 @@
(load-file file-path)
(catch Exception e
(println)
(println e)
(println "Problem in " file-path)
(println "---------------------")
(println "Assertion failed!")
(println (.replaceFirst (.getMessage (.getCause e))
"^Assert failed: "
""))
false)))
(defn namaste []