Commits

Anonymous committed cbf2bd4

add not-obj? function with tests

Comments (0)

Files changed (2)

src/main/clj/org/bituf/clj_miscutil.clj

   (instance? clojure.lang.IObj obj))
 
 
+(defn not-obj?
+  "Same as (not (obj? arg))"
+  [arg]
+  (not (obj? arg)))
+
+
 (defn- mdata-types
   "Return meta data (map) and types (set) the object belongs to."
   [obj]

src/test/clj/org/bituf/test_clj_miscutil.clj

 
 
 (deftest test-type-annotation
+  (testing "obj?"
+    (is (obj? {}))
+    (is (not (obj? 10))))
+  (testing "not-obj?"
+    (is (not (not-obj? {})))
+    (is (not-obj? 10)))
   (testing "implied-types"
     (with-implied-types {:employee [:salaried :person]
                          :salaried [:person]}