Skip to content

Commit c915669

Browse files
committed
add test for failing special case
1 parent cac8f1e commit c915669

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

test/malli/parser_test.cljc

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,18 @@
8282

8383
(def transforming-parser-schemas
8484
"Schemas with transforming parsers."
85-
[[:andn [:any :any]] [:catn [:any :any]] [:seqable [:catn [:any :any]]] [:multi {:dispatch #'any?} [true :any]]])
85+
[[:andn [:any :any]]
86+
[:catn [:any :any]]
87+
[:seqable [:catn [:any :any]]]
88+
[:multi {:dispatch #'any?} [true :any]]])
8689

8790
(defn ensure-parser-type [expected-simple s]
8891
#?(:bb nil ;; test.chuck doesn't work in bb
8992
:default (let [s (m/schema s)
9093
parse (m/parser s)
9194
unparse (m/parser s)]
9295
(if expected-simple
93-
(doseq [g (is (doall (mg/sample s)))]
96+
(doseq [g (mg/sample s)]
9497
(testing (pr-str g)
9598
(let [p (parse g)]
9699
(is (identical? g p))
@@ -126,6 +129,15 @@
126129
(is (= expected-simple (simple-parser? s)))
127130
(ensure-parser-type expected-simple s)))))
128131

132+
;;seems to fail cljs
133+
(deftest map-special-case-test
134+
(let [s [:map [:foo :any] [:bar :int]]
135+
parse (m/parser s)
136+
unparse (m/unparser s)
137+
g {:foo ##NaN :bar -4}
138+
p (parse g)]
139+
(is (identical? g p))))
140+
129141
(deftest and-complex-parser-test
130142
(is (= {} (m/parse [:and :map [:fn map?]] {})))
131143
(is (= {} (m/parse [:and [:fn map?] :map] {})))

0 commit comments

Comments
 (0)