aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscgilardi <scgilardi@gmail.com>2009-02-22 19:22:27 +0000
committerscgilardi <scgilardi@gmail.com>2009-02-22 19:22:27 +0000
commit957f697ee57d19f76852e9cbe33e5e6a3c655c70 (patch)
tree72d391d5819fd4a65b9158c6c13e18c5c6b2da84
parente8c24227572165dc3d7fd791714c1c7915fbbe9d (diff)
make test-clojure load 'cleanly', add run function and -main
-rw-r--r--build.xml1
-rw-r--r--src/clojure/contrib/test_clojure.clj48
2 files changed, 30 insertions, 19 deletions
diff --git a/build.xml b/build.xml
index 04cd7ec6..33d453ae 100644
--- a/build.xml
+++ b/build.xml
@@ -87,6 +87,7 @@
<arg value="clojure.contrib.sql.internal"/>
<arg value="clojure.contrib.sql"/>
<arg value="clojure.contrib.str-utils"/>
+ <arg value="clojure.contrib.test-clojure"/>
<arg value="clojure.contrib.test-is"/>
<arg value="clojure.contrib.trace"/>
<arg value="clojure.contrib.zip-filter"/>
diff --git a/src/clojure/contrib/test_clojure.clj b/src/clojure/contrib/test_clojure.clj
index f3217576..3dc6a43e 100644
--- a/src/clojure/contrib/test_clojure.clj
+++ b/src/clojure/contrib/test_clojure.clj
@@ -14,26 +14,36 @@
;; Created 22 October 2008
(ns clojure.contrib.test-clojure
- (:use clojure.contrib.test-is))
+ (:use clojure.contrib.test-is)
+ (:gen-class))
-(def tests [:reader
- :printer
- :evaluation
- :predicates
- :logic
- :data-structures
- :numbers
- :sequences
- :for
- :agents
- :main
- ])
+(def test-names
+ [:reader
+ :printer
+ :evaluation
+ :predicates
+ :logic
+ :data-structures
+ :numbers
+ :sequences
+ :for
+ :agents
+ :main
+ ])
-(defn test-name
- [test]
- (symbol (str "clojure.contrib.test-clojure." (name test))))
+(def test-namespaces
+ (map #(symbol (str "clojure.contrib.test-clojure." (name %)))
+ test-names))
-(doseq [test tests]
- (require (test-name test)))
+(defn run
+ "Runs all defined tests"
+ []
+ (println "Loading tests...")
+ (apply require :reload-all test-namespaces)
+ (apply clojure.contrib.test-is/run-tests test-namespaces))
-(apply run-tests (map test-name tests))
+(defn -main
+ "Run all defined tests from the command line"
+ [& args]
+ (run)
+ (System/exit 0))