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

Commit

Permalink
Add tests for Var metadata contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
arrdem committed Feb 13, 2016
1 parent 59bff93 commit a351fe9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/clojure/test_clojure/rt.clj
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,26 @@
(.refer ns 'subset? #'clojure.set/intersection)))
(is (nil? ('subset? (ns-publics ns))))
(is (= #'clojure.set/subset? ('subset? (ns-refers ns)))))))

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

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

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

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

0 comments on commit a351fe9

Please sign in to comment.