From 49e460a0b451342705cac6b785e8f43871ee5e97 Mon Sep 17 00:00:00 2001 From: Aaron Bedra Date: Thu, 14 Jan 2010 20:13:17 -0500 Subject: [PATCH] starting... lots of work to do --- .gitignore | 1 + README.markdown | 19 +++++++++++++++++++ build.xml | 22 ++++++++++++++++++++++ koans/about_asserts_test.clj | 12 ++++++++++++ koans/path_to_enlightenment.clj | 20 ++++++++++++++++++++ project.clj | 6 ++++++ 6 files changed, 80 insertions(+) create mode 100644 .gitignore create mode 100644 README.markdown create mode 100644 build.xml create mode 100644 koans/about_asserts_test.clj create mode 100644 koans/path_to_enlightenment.clj create mode 100644 project.clj diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7951405 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +lib \ No newline at end of file diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..440f5b9 --- /dev/null +++ b/README.markdown @@ -0,0 +1,19 @@ +# Functional Koans + +### Getting Started + +To download the dependencies, install leiningen +(http://github.com/technomancy/leiningen). After you have leiningen +installed run + +`lein deps` + +which will download all dependencies you need to run the clojure koans. + +### Running The Koans + +To run the koans, simply run + +`ant` + +which will run all the files in the koans directory. diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..e34ac4f --- /dev/null +++ b/build.xml @@ -0,0 +1,22 @@ + + + functional-koans + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/koans/about_asserts_test.clj b/koans/about_asserts_test.clj new file mode 100644 index 0000000..78b2705 --- /dev/null +++ b/koans/about_asserts_test.clj @@ -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))))) \ No newline at end of file diff --git a/koans/path_to_enlightenment.clj b/koans/path_to_enlightenment.clj new file mode 100644 index 0000000..70789e4 --- /dev/null +++ b/koans/path_to_enlightenment.clj @@ -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))) \ No newline at end of file diff --git a/project.clj b/project.clj new file mode 100644 index 0000000..9ededd9 --- /dev/null +++ b/project.clj @@ -0,0 +1,6 @@ +(defproject functional-koans "0.0.1" + :description "The functional koans" + :dependencies [[org.clojure/clojure "1.1.0"] + [org.clojure/clojure-contrib "1.0-SNAPSHOT"]] + :dev-dependencies [[lein-clojars "0.5.0-SNAPSHOT"]] + :namespaces [koans]) \ No newline at end of file