Skip to content

Commit

Permalink
Add tests for undef-all
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhan0 committed Apr 23, 2021
1 parent a001267 commit 1a70aaa
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/clj/cider/nrepl/middleware/undef_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,27 @@
(is (:pp-stacktrace response))
(is (:err response))
(is (:ex response)))))

(deftest undef-all-test
(testing "undef-all undefines all vars in namespace"
(is (= #{"done"}
(:status (session/message {:op "eval"
:code "(do (ns other.ns (:require [clojure.walk :as walk :refer [postwalk]])))"}))))
(is (= ["#'clojure.core/assoc"]
(:value (session/message {:op "eval"
:code "(do (in-ns 'user) (ns-resolve 'other.ns 'assoc))"}))))
(is (= ["#'clojure.walk/postwalk"]
(:value (session/message {:op "eval"
:code "(ns-resolve 'other.ns 'postwalk)"}))))
(is (= #{"done"}
(:status (session/message {:op "undef-all"
:ns "other.ns"}))))
(is (= ["nil"]
(:value (session/message {:op "eval"
:code "(ns-resolve 'other.ns 'assoc)"}))))
(is (= ["nil"]
(:value (session/message {:op "eval"
:code "(ns-resolve 'other.ns 'postwalk)"}))))
(is (= ["{}"]
(:value (session/message {:op "eval"
:code "(ns-aliases 'other.ns)"}))))))

0 comments on commit 1a70aaa

Please sign in to comment.