Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 4e62c17070
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 20 lines (18 sloc) 0.768 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
(ns clojure.contrib.test-with-ns
  (:use clojure.test
clojure.contrib.with-ns
        [clojure.contrib.seq :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))))))))
Something went wrong with that request. Please try again.