make MAP-VALS work on nil

This commit is contained in:
Nathan Marz 2016-06-11 09:51:28 -04:00
parent 589e6aa471
commit f26aa001eb
2 changed files with 10 additions and 0 deletions

View file

@ -907,6 +907,11 @@
structure)) structure))
(extend-protocol MapValsTransformProtocol (extend-protocol MapValsTransformProtocol
nil
(map-vals-transform [structure next-fn]
nil
)
#+clj clojure.lang.PersistentArrayMap #+cljs cljs.core/PersistentArrayMap #+clj clojure.lang.PersistentArrayMap #+cljs cljs.core/PersistentArrayMap
(map-vals-transform [structure next-fn] (map-vals-transform [structure next-fn]
(map-vals-non-transient-transform structure {} next-fn) (map-vals-non-transient-transform structure {} next-fn)

View file

@ -1202,6 +1202,11 @@
(is (empty? (select s/ALL nil))) (is (empty? (select s/ALL nil)))
) )
(deftest map-vals-nil
(is (= nil (transform s/MAP-VALS inc nil)))
(is (empty? (select s/MAP-VALS nil)))
)
(defspec dispense-test (defspec dispense-test
(for-all+ (for-all+
[k1 gen/int [k1 gen/int