diff options
author | Stuart Halloway <stu@thinkrelevance.com> | 2010-04-13 10:03:12 -0400 |
---|---|---|
committer | Stuart Halloway <stu@thinkrelevance.com> | 2010-04-13 10:03:12 -0400 |
commit | b52f0b60c0e777724fa3591c43bdba83a16968c8 (patch) | |
tree | 61fc36bb9dc9d950952d8dca2b0611d0a09dd830 | |
parent | b9db2805f9571d52d5f0bb0b726fee1ca70c821d (diff) |
test-load-all tries to load all nondeprecated namespaces
- fixed bug: misspelling in pom
- updated gen-html-docs to track c.c.string name changes
-rw-r--r-- | pom.xml | 2 | ||||
-rw-r--r-- | src/main/clojure/clojure/contrib/gen_html_docs.clj | 11 | ||||
-rw-r--r-- | src/main/clojure/clojure/contrib/load_all.clj | 91 | ||||
-rw-r--r-- | src/test/clojure/clojure/contrib/test_load_all.clj | 53 |
4 files changed, 60 insertions, 97 deletions
@@ -93,7 +93,7 @@ <namespaces> <namespace>clojure\.contrib\.jmx\.Bean</namespace> <namespace>clojure\.contrib\.fnmap\.PersistentFnMap</namespace> - <namespace>clojure\.contrib\.conditition\.Condition</namespace> + <namespace>clojure\.contrib\.condition\.Condition</namespace> <namespace>clojure\.contrib\.repl-ln</namespace> <namespace>clojure\.contrib\.pprint\.gen-class</namespace> </namespaces> diff --git a/src/main/clojure/clojure/contrib/gen_html_docs.clj b/src/main/clojure/clojure/contrib/gen_html_docs.clj index 53d205b3..a9a66742 100644 --- a/src/main/clojure/clojure/contrib/gen_html_docs.clj +++ b/src/main/clojure/clojure/contrib/gen_html_docs.clj @@ -46,8 +46,9 @@ :doc "Generates a single HTML page that contains the documentation for one or more Clojure libraries."} clojure.contrib.gen-html-docs - (:require [clojure.contrib.io :as io]) - (:use [clojure.contrib seq string repl-utils def prxml]) + (:require [clojure.contrib.io :as io] + [clojure.contrib.string :as s]) + (:use [clojure.contrib seq repl-utils def prxml]) (:import [java.lang Exception] [java.util.regex Pattern])) @@ -226,7 +227,7 @@ function toggle(targetid, linkid, textWhenOpen, textWhenClosed) (if (= 0 (count l)) [:span {:class "library-member-doc-whitespace"} " "] ; We need something here to make the blank line show up l)]) - (re-split #"\n" docs)) + (s/split #"\n" docs)) "")) (defn- member-type @@ -270,7 +271,7 @@ function toggle(targetid, linkid, textWhenOpen, textWhenClosed) (defn- elide-to-one-line "Elides a string down to one line." [s] - (re-sub #"(\n.*)+" "..." s)) + (s/replace-re #"(\n.*)+" "..." s)) (defn- elide-string "Returns a string that is at most the first limit characters of s" @@ -282,7 +283,7 @@ function toggle(targetid, linkid, textWhenOpen, textWhenClosed) (defn- doc-elided-src "Returns the src with the docs elided." [docs src] - (re-sub (re-pattern (str "\"" (Pattern/quote docs) "\"")) + (s/replace-re (re-pattern (str "\"" (Pattern/quote docs) "\"")) (str "\"" (elide-to-one-line docs) ;; (elide-string docs 10) diff --git a/src/main/clojure/clojure/contrib/load_all.clj b/src/main/clojure/clojure/contrib/load_all.clj deleted file mode 100644 index 8d3ac4ed..00000000 --- a/src/main/clojure/clojure/contrib/load_all.clj +++ /dev/null @@ -1,91 +0,0 @@ -;;; load_all.clj - loads all contrib libraries for testing purposes - -;; by Stuart Sierra, http://stuartsierra.com/ -;; February 21, 2009 - -;; Copyright (c) Stuart Sierra, 2009. All rights reserved. The use -;; and distribution terms for this software are covered by the Eclipse -;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) -;; which can be found in the file epl-v10.html at the root of this -;; distribution. By using this software in any fashion, you are -;; agreeing to be bound by the terms of this license. You must not -;; remove this notice, or any other, from this software. - - -;; This file simple attempts to "require" every library in -;; clojure-contrib. The names of all contrib libs (minus the -;; "clojure.contrib" part) are in *all-contrib-libs*. Libraries which -;; throw errors when loading under the latest trunk SVN revisions of -;; Clojure and clojure-contrib are commented out. -;; -;; This is only intended to check that the libraries will load without -;; errors, not that they work correctly. If the libraries have tests -;; defined using test-is, you can run them with: -;; -;; (clojure.test/run-all-tests) -;; -;; If you write a new lib, please add it to the list in this file. - - -(ns clojure.contrib.load-all) - -(def *all-contrib-libs* '[ -accumulators -apply-macro -combinatorics -command-line -complex-numbers -cond -def -io -error-kit -except -fcase -generic -generic.arithmetic -generic.collection -generic.comparison -generic.functor -generic.math-functions -import-static -jar -;; javadoc - moved to repl-utils -javadoc.browse -;; javalog -json.read -json.write -lazy-seqs -lazy-xml -macro-utils -macros -math -miglayout -mmap -monads -ns-utils -pprint -probabilities.finite-distributions -probabilities.monte-carlo -probabilities.random-numbers -prxml -repl-ln -repl-utils -seq -server-socket -set -shell -sql -string -string -stream-utils -swing-utils -test-contrib -test-contrib.shell -test-contrib.string -trace -types -zip-filter -]) - -(doseq [name *all-contrib-libs*] - (require (symbol (str "clojure.contrib." name)))) diff --git a/src/test/clojure/clojure/contrib/test_load_all.clj b/src/test/clojure/clojure/contrib/test_load_all.clj new file mode 100644 index 00000000..15bcc4f1 --- /dev/null +++ b/src/test/clojure/clojure/contrib/test_load_all.clj @@ -0,0 +1,53 @@ +;;; test_load_all.clj - loads all contrib libraries for testing purposes + +;; by Stuart Halloway, http://blog.thinkrelevance.com + +;; Copyright (c) Stuart Halloway, 2009. All rights reserved. The use +;; and distribution terms for this software are covered by the Eclipse +;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) +;; which can be found in the file epl-v10.html at the root of this +;; distribution. By using this software in any fashion, you are +;; agreeing to be bound by the terms of this license. You must not +;; remove this notice, or any other, from this software. + +;; This is only intended to check that the libraries will load without +;; errors, not that they work correctly. + +;; The code includes several design choices I don't love, but find +;; tolerable in a test-only lib: +;; +;; * namespaces that blow up to document deprecation +;; * using directory paths to find contrib +;; * using a macro to reflectively write tests +;; +;; I *am* happy that code that won't even load now breaks the build. + +(ns clojure.contrib.test-load-all + (:use clojure.test clojure.contrib.find-namespaces)) + +(def deprecated-contrib-namespaces + '[clojure.contrib.javadoc]) + +(defn loadable-contrib-namespaces + "Contrib namespaces that can be loaded (everything except + deprecated nses that throw on load.)" + [] + (apply disj + (into #{} (find-namespaces-in-dir (java.io.File. "src/main"))) + deprecated-contrib-namespaces)) + +(defn emit-test-load + [] + `(do + ~@(map + (fn [ns] + `(deftest ~(symbol (str "test-loading-" (.replace (str ns) "." "-"))) + (require :reload '~ns))) + (loadable-contrib-namespaces)))) + +(defmacro test-load + [] + (emit-test-load)) + +(test-load) + |