Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit b52f0b60c0e777724fa3591c43bdba83a16968c8 1 parent b9db280
@stuarthalloway stuarthalloway authored
View
2  pom.xml
@@ -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>
View
11 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)
View
91 src/main/clojure/clojure/contrib/load_all.clj
@@ -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))))
View
53 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)
+
Please sign in to comment.
Something went wrong with that request. Please try again.