Mercurial > lasercutter
view src/clojure/contrib/test_contrib/test_load_all.clj @ 10:ef7dbbd6452c
added clojure source goodness
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 21 Aug 2010 06:25:44 -0400 |
parents | |
children |
line wrap: on
line source
1 ;;; test_load_all.clj - loads all contrib libraries for testing purposes3 ;; by Stuart Halloway, http://blog.thinkrelevance.com5 ;; Copyright (c) Stuart Halloway, 2009. All rights reserved. The use6 ;; and distribution terms for this software are covered by the Eclipse7 ;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)8 ;; which can be found in the file epl-v10.html at the root of this9 ;; distribution. By using this software in any fashion, you are10 ;; agreeing to be bound by the terms of this license. You must not11 ;; remove this notice, or any other, from this software.13 ;; This is only intended to check that the libraries will load without14 ;; errors, not that they work correctly.16 ;; The code includes several design choices I don't love, but find17 ;; tolerable in a test-only lib:18 ;;19 ;; * namespaces that blow up to document deprecation20 ;; * using directory paths to find contrib21 ;; * using a macro to reflectively write tests22 ;;23 ;; I *am* happy that code that won't even load now breaks the build.25 (ns clojure.contrib.test-load-all26 (:use clojure.test clojure.contrib.find-namespaces))28 (def deprecated-contrib-namespaces29 '[clojure.contrib.javadoc])31 (defn loadable-contrib-namespaces32 "Contrib namespaces that can be loaded (everything except33 deprecated nses that throw on load.)"34 []35 (apply disj36 (into #{} (find-namespaces-in-dir (java.io.File. "src/main")))37 deprecated-contrib-namespaces))39 (defn emit-test-load40 []41 `(do42 ~@(map43 (fn [ns]44 `(deftest ~(symbol (str "test-loading-" (.replace (str ns) "." "-")))45 (require :reload '~ns)))46 (loadable-contrib-namespaces))))48 (defmacro test-load49 []50 (emit-test-load))52 (test-load)