Mercurial > lasercutter
comparison 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 |
comparison
equal
deleted
inserted
replaced
9:35cf337adfcf | 10:ef7dbbd6452c |
---|---|
1 (ns clojure.contrib.test-with-ns | |
2 (:use clojure.test | |
3 clojure.contrib.with-ns)) | |
4 | |
5 (deftest test-namespace-gets-removed | |
6 (let [all-ns-names (fn [] (map #(.name %) (all-ns)))] | |
7 (testing "unexceptional return" | |
8 (let [ns-name (with-temp-ns (ns-name *ns*))] | |
9 (is (not (some #{ns-name} (all-ns-names)))))) | |
10 (testing "when an exception is thrown" | |
11 (let [ns-name-str | |
12 (try | |
13 (with-temp-ns | |
14 (throw (RuntimeException. (str (ns-name *ns*))))) | |
15 (catch clojure.lang.Compiler$CompilerException e | |
16 (-> e .getCause .getMessage)))] | |
17 (is (re-find #"^sym.*$" ns-name-str)) | |
18 (is (not (some #{(symbol ns-name-str)} (all-ns-names)))))))) |