test defined?
This commit is contained in:
parent
0dc976913c
commit
8b79ccb845
|
@ -166,7 +166,7 @@
|
||||||
"return true if value is undefined"
|
"return true if value is undefined"
|
||||||
(= value (. UniqueTag NOT_FOUND)))
|
(= value (. UniqueTag NOT_FOUND)))
|
||||||
|
|
||||||
(def defined? (comp not undefined?))
|
(def defined? (complement undefined?))
|
||||||
|
|
||||||
(defn set! [scope name value]
|
(defn set! [scope name value]
|
||||||
"bind an object to a name in scope"
|
"bind an object to a name in scope"
|
||||||
|
|
|
@ -36,6 +36,10 @@
|
||||||
(is (not (js/undefined? 1)))
|
(is (not (js/undefined? 1)))
|
||||||
(is (js/undefined? (. UniqueTag NOT_FOUND))))
|
(is (js/undefined? (. UniqueTag NOT_FOUND))))
|
||||||
|
|
||||||
|
(testing "defined? works"
|
||||||
|
(is (js/defined? 1))
|
||||||
|
(is (not (js/defined? (. UniqueTag NOT_FOUND)))))
|
||||||
|
|
||||||
(testing "get returns undefined if get'ing inexistent var"
|
(testing "get returns undefined if get'ing inexistent var"
|
||||||
(let [scope (js/new-scope)]
|
(let [scope (js/new-scope)]
|
||||||
(is (js/undefined? (js/get scope "foo")))))
|
(is (js/undefined? (js/get scope "foo")))))
|
||||||
|
|
Reference in a new issue