rlm@10: ;;; test_load_all.clj - loads all contrib libraries for testing purposes rlm@10: rlm@10: ;; by Stuart Halloway, http://blog.thinkrelevance.com rlm@10: rlm@10: ;; Copyright (c) Stuart Halloway, 2009. All rights reserved. The use rlm@10: ;; and distribution terms for this software are covered by the Eclipse rlm@10: ;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) rlm@10: ;; which can be found in the file epl-v10.html at the root of this rlm@10: ;; distribution. By using this software in any fashion, you are rlm@10: ;; agreeing to be bound by the terms of this license. You must not rlm@10: ;; remove this notice, or any other, from this software. rlm@10: rlm@10: ;; This is only intended to check that the libraries will load without rlm@10: ;; errors, not that they work correctly. rlm@10: rlm@10: ;; The code includes several design choices I don't love, but find rlm@10: ;; tolerable in a test-only lib: rlm@10: ;; rlm@10: ;; * namespaces that blow up to document deprecation rlm@10: ;; * using directory paths to find contrib rlm@10: ;; * using a macro to reflectively write tests rlm@10: ;; rlm@10: ;; I *am* happy that code that won't even load now breaks the build. rlm@10: rlm@10: (ns clojure.contrib.test-load-all rlm@10: (:use clojure.test clojure.contrib.find-namespaces)) rlm@10: rlm@10: (def deprecated-contrib-namespaces rlm@10: '[clojure.contrib.javadoc]) rlm@10: rlm@10: (defn loadable-contrib-namespaces rlm@10: "Contrib namespaces that can be loaded (everything except rlm@10: deprecated nses that throw on load.)" rlm@10: [] rlm@10: (apply disj rlm@10: (into #{} (find-namespaces-in-dir (java.io.File. "src/main"))) rlm@10: deprecated-contrib-namespaces)) rlm@10: rlm@10: (defn emit-test-load rlm@10: [] rlm@10: `(do rlm@10: ~@(map rlm@10: (fn [ns] rlm@10: `(deftest ~(symbol (str "test-loading-" (.replace (str ns) "." "-"))) rlm@10: (require :reload '~ns))) rlm@10: (loadable-contrib-namespaces)))) rlm@10: rlm@10: (defmacro test-load rlm@10: [] rlm@10: (emit-test-load)) rlm@10: rlm@10: (test-load) rlm@10: