Remove clojure.test dependencies
This commit is contained in:
parent
5a5f519fb8
commit
e6174d80dc
@ -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
|
||||
|
@ -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)))
|
||||
|
||||
|
@ -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 []
|
||||
|
Loading…
Reference in New Issue
Block a user