annotate src/clojure/contrib/test_contrib/test_with_ns.clj @ 10:ef7dbbd6452c

added clojure source goodness
author Robert McIntyre <rlm@mit.edu>
date Sat, 21 Aug 2010 06:25:44 -0400
parents
children
rev   line source
rlm@10 1 (ns clojure.contrib.test-with-ns
rlm@10 2 (:use clojure.test
rlm@10 3 clojure.contrib.with-ns))
rlm@10 4
rlm@10 5 (deftest test-namespace-gets-removed
rlm@10 6 (let [all-ns-names (fn [] (map #(.name %) (all-ns)))]
rlm@10 7 (testing "unexceptional return"
rlm@10 8 (let [ns-name (with-temp-ns (ns-name *ns*))]
rlm@10 9 (is (not (some #{ns-name} (all-ns-names))))))
rlm@10 10 (testing "when an exception is thrown"
rlm@10 11 (let [ns-name-str
rlm@10 12 (try
rlm@10 13 (with-temp-ns
rlm@10 14 (throw (RuntimeException. (str (ns-name *ns*)))))
rlm@10 15 (catch clojure.lang.Compiler$CompilerException e
rlm@10 16 (-> e .getCause .getMessage)))]
rlm@10 17 (is (re-find #"^sym.*$" ns-name-str))
rlm@10 18 (is (not (some #{(symbol ns-name-str)} (all-ns-names))))))))