Skip to content
This repository has been archived by the owner on Jan 28, 2019. It is now read-only.

Commit

Permalink
Silence Var metadata warnings in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arrdem committed Feb 13, 2016
1 parent a351fe9 commit 2681f88
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions test/clojure/test_clojure/rt.clj
Original file line number Diff line number Diff line change
Expand Up @@ -104,25 +104,33 @@
(is (nil? ('subset? (ns-publics ns))))
(is (= #'clojure.set/subset? ('subset? (ns-refers ns)))))))

(defmacro silenced [& forms]
`(binding [*err* (new java.io.StringWriter)]
~@forms))

(deftest var-meta-tests
(testing "Var.resetMeta should clear flags, getters"
(let [v (def a-test-v)]
(do (.resetMeta v {})
(do (silenced
(.resetMeta v {}))
(is (.isPublic v))
(is (not (.isDynamic v)))
(is (not (.isMacro v))))

(do (.resetMeta v {:private true})
(do (silenced
(.resetMeta v {:private true}))
(is (not (.isPublic v)))
(is (not (.isDynamic v)))
(is (not (.isMacro v))))

(do (.resetMeta v {:dynamic true})
(do (silenced
(.resetMeta v {:dynamic true}))
(is (.isPublic v))
(is (.isDynamic v))
(is (not (.isMacro v))))

(do (.resetMeta v {:macro true})
(do (silenced
(.resetMeta v {:macro true}))
(is (.isPublic v))
(is (not (.isDynamic v)))
(is (.isMacro v))))))

0 comments on commit 2681f88

Please sign in to comment.