This repository has been archived by the owner on May 3, 2024. It is now read-only.
forked from richhickey/clojure-contrib
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clean up temporary namespaces, fixes #54
- Loading branch information
1 parent
3764e2e
commit f24f641
Showing
3 changed files
with
27 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
(ns clojure.contrib.test-contrib.with-ns-test | ||
(:use clojure.test | ||
clojure.contrib.with-ns | ||
[clojure.contrib.seq-utils :only (includes?)])) | ||
|
||
(deftest test-namespace-gets-removed | ||
(let [all-ns-names (fn [] (map #(.name %) (all-ns)))] | ||
(testing "unexceptional return" | ||
(let [ns-name (with-temp-ns (ns-name *ns*))] | ||
(is (not (includes? (all-ns-names) ns-name))))) | ||
(testing "when an exception is thrown" | ||
(let [ns-name-str | ||
(try | ||
(with-temp-ns | ||
(throw (RuntimeException. (str (ns-name *ns*))))) | ||
(catch clojure.lang.Compiler$CompilerException e | ||
(-> e .getCause .getMessage)))] | ||
(is (re-find #"^sym.*$" ns-name-str)) | ||
(is (not (includes? (all-ns-names) (symbol ns-name-str)))))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters