starting... lots of work to do
This commit is contained in:
12
koans/about_asserts_test.clj
Normal file
12
koans/about_asserts_test.clj
Normal file
@@ -0,0 +1,12 @@
|
||||
(ns about-asserts-test
|
||||
(:use clojure.test))
|
||||
|
||||
(deftest test-truth
|
||||
(testing "We shall contemplate truth by testing reality, via asserts."
|
||||
(assert false))) ;; This should be true
|
||||
|
||||
(deftest test-assert-equality
|
||||
(testing "To understand reality, we must compare our expectations against reality."
|
||||
(let [expected-value 0
|
||||
actual-value (+ 1 1)]
|
||||
(is (= expected-value actual-value)))))
|
20
koans/path_to_enlightenment.clj
Normal file
20
koans/path_to_enlightenment.clj
Normal file
@@ -0,0 +1,20 @@
|
||||
(use 'clojure.contrib.find-namespaces
|
||||
'clojure.test)
|
||||
|
||||
(def exit-code (atom 0))
|
||||
|
||||
(defn find-tests []
|
||||
(filter
|
||||
#(re-find #"-test" (str %)) (find-namespaces-in-dir (java.io.File. "."))))
|
||||
|
||||
(defn require-tests []
|
||||
|
||||
(doseq [test (find-tests)]
|
||||
(require test)))
|
||||
|
||||
(require-tests)
|
||||
(let [results (apply merge-with + (map test-ns (find-tests)))]
|
||||
(if (or (> (results :fail) 0)
|
||||
(> (results :error) 0))
|
||||
(System/exit -1)
|
||||
(System/exit 0)))
|
Reference in New Issue
Block a user