From d280c885b5109b88d177024bfe0b49e233312876 Mon Sep 17 00:00:00 2001 From: Tommi Reiman Date: Wed, 1 Jan 2025 14:27:50 +0200 Subject: [PATCH] format code --- src/malli/registry.cljc | 2 +- test/malli/assert_test.cljc | 8 +- test/malli/clj_kondo_test.cljc | 12 +- test/malli/core_test.cljc | 8 +- test/malli/distributive_test.cljc | 166 ++++++++++++------------- test/malli/error_test.cljc | 60 ++++----- test/malli/experimental/time_test.cljc | 36 +++--- test/malli/generator_test.cljc | 4 +- test/malli/instrument_test.clj | 6 +- test/malli/registry_test.cljc | 8 +- test/malli/util_test.cljc | 36 +++--- 11 files changed, 173 insertions(+), 173 deletions(-) diff --git a/src/malli/registry.cljc b/src/malli/registry.cljc index 79e9fe3f3..0a98755e1 100644 --- a/src/malli/registry.cljc +++ b/src/malli/registry.cljc @@ -40,7 +40,7 @@ (def ^:private registry* (atom (simple-registry {}))) (defn set-default-registry! [?registry] - (if-not #?(:cljs (identical? mode "strict") + (if-not #?(:cljs (identical? mode "strict") :default (= mode "strict")) (reset! registry* (registry ?registry)) (throw (ex-info "can't set default registry, invalid mode" {:mode mode, :type type})))) diff --git a/test/malli/assert_test.cljc b/test/malli/assert_test.cljc index 0629256a2..3be0a1d1f 100644 --- a/test/malli/assert_test.cljc +++ b/test/malli/assert_test.cljc @@ -9,9 +9,9 @@ (deftest assert-throws-test (is (thrown? #?(:clj Exception, :cljs js/Error) - (assert :int "42" ))) + (assert :int "42"))) (is (thrown? #?(:clj Exception, :cljs js/Error) - (assert int? "42" ))) + (assert int? "42"))) (is (thrown? #?(:clj Exception, :cljs js/Error) (assert string? 42))) (is (thrown? #?(:clj Exception, :cljs js/Error) @@ -22,8 +22,8 @@ (assert ::invalid-schema 42)))) (deftest assert-checked-and-does-not-throw - (is (= 42 (assert :int 42 ))) - (is (= 42 (assert int? 42 ))) + (is (= 42 (assert :int 42))) + (is (= 42 (assert int? 42))) (is (= "42" (assert string? "42"))) (is (= nil (assert any? nil))) (is (= {:a 42} (assert [:map [:a int?]] {:a 42})))) diff --git a/test/malli/clj_kondo_test.cljc b/test/malli/clj_kondo_test.cljc index 4c15c5c68..f8d1a5f19 100644 --- a/test/malli/clj_kondo_test.cljc +++ b/test/malli/clj_kondo_test.cljc @@ -53,21 +53,21 @@ (defn clj-kondo-issue-1922-1 [_x]) (m/=> clj-kondo-issue-1922-1 - [:=> [:cat [:map [:keys [:+ :keyword]]]] :nil]) + [:=> [:cat [:map [:keys [:+ :keyword]]]] :nil]) (defn clj-kondo-issue-1922-2 [_x]) (m/=> clj-kondo-issue-1922-2 - [:=> [:cat [:map [:keys [:* :int]]]] :nil]) + [:=> [:cat [:map [:keys [:* :int]]]] :nil]) (defn clj-kondo-issue-1922-3 [_x]) (m/=> clj-kondo-issue-1922-3 - [:=> [:cat [:map [:keys [:? :string]]]] :nil]) + [:=> [:cat [:map [:keys [:? :string]]]] :nil]) (defn clj-kondo-issue-1922-4 [_x]) (m/=> clj-kondo-issue-1922-4 - [:function - [:=> [:cat :int :int] :nil] - [:=> [:cat :int :int [:repeat :int]] :nil]]) + [:function + [:=> [:cat :int :int] :nil] + [:=> [:cat :int :int [:repeat :int]] :nil]]) (defn clj-kondo-issue-836-1 "Predicate `:fn` schema's should be type-checked as expecting to be passed `:any`, not a fn." diff --git a/test/malli/core_test.cljc b/test/malli/core_test.cljc index a1f49b579..6899e7513 100644 --- a/test/malli/core_test.cljc +++ b/test/malli/core_test.cljc @@ -3509,10 +3509,10 @@ (deftest catch-infinitely-expanding-schema (is (thrown-with-msg? - #?(:clj Exception, :cljs js/Error) - #?(:clj #":malli\.core/infinitely-expanding-schema" - :cljs #":malli\.core/invalid-schema") - (m/schema [(m/schema :any)])))) + #?(:clj Exception, :cljs js/Error) + #?(:clj #":malli\.core/infinitely-expanding-schema" + :cljs #":malli\.core/invalid-schema") + (m/schema [(m/schema :any)])))) (deftest eduction-test (is (m/validate [:sequential {:min 0} :int] (eduction identity (range 10)))) diff --git a/test/malli/distributive_test.cljc b/test/malli/distributive_test.cljc index df84339c0..b5da4ab49 100644 --- a/test/malli/distributive_test.cljc +++ b/test/malli/distributive_test.cljc @@ -16,73 +16,73 @@ (deftest distributive-multi-test (is (= (dist - [:merge - [:map [:x :int]] - [:multi {:dispatch :y} - [1 [:map [:y [:= 1]]]] - [2 [:map [:y [:= 2]]]]]]) + [:merge + [:map [:x :int]] + [:multi {:dispatch :y} + [1 [:map [:y [:= 1]]]] + [2 [:map [:y [:= 2]]]]]]) [:multi {:dispatch :y} [1 [:map [:x :int] [:y [:= 1]]]] [2 [:map [:x :int] [:y [:= 2]]]]])) (is (= (dist - [:merge - [:map [:x :int]] - [:schema - [:multi {:dispatch :y} - [1 [:map [:y [:= 1]]]] - [2 [:map [:y [:= 2]]]]]]]) + [:merge + [:map [:x :int]] + [:schema + [:multi {:dispatch :y} + [1 [:map [:y [:= 1]]]] + [2 [:map [:y [:= 2]]]]]]]) [:multi {:dispatch :y} [1 [:map [:x :int] [:y [:= 1]]]] [2 [:map [:x :int] [:y [:= 2]]]]])) (is (= (dist - [:merge - [:multi {:dispatch :y} - [1 [:map [:y [:= 1]]]] - [2 [:map [:y [:= 2]]]]] - [:map [:x :int]]]) + [:merge + [:multi {:dispatch :y} + [1 [:map [:y [:= 1]]]] + [2 [:map [:y [:= 2]]]]] + [:map [:x :int]]]) [:multi {:dispatch :y} [1 [:map [:y [:= 1]] [:x :int]]] [2 [:map [:y [:= 2]] [:x :int]]]])) (is (= (dist + [:merge + [:multi {:dispatch :y} + [1 [:map [:y [:= 1]]]] + [2 [:map [:y [:= 2]]]]] + [:map [:x :int]] + [:map [:z :int]]]) + (dist + [:merge [:merge [:multi {:dispatch :y} [1 [:map [:y [:= 1]]]] [2 [:map [:y [:= 2]]]]] - [:map [:x :int]] - [:map [:z :int]]]) - (dist - [:merge - [:merge - [:multi {:dispatch :y} - [1 [:map [:y [:= 1]]]] - [2 [:map [:y [:= 2]]]]] - [:map [:x :int]]] - [:map [:z :int]]]) + [:map [:x :int]]] + [:map [:z :int]]]) [:multi {:dispatch :y} [1 [:map [:y [:= 1]] [:x :int] [:z :int]]] [2 [:map [:y [:= 2]] [:x :int] [:z :int]]]])) (is (= (dist - [:merge - [:multi {:dispatch :y} - [1 [:map [:y [:= 1]]]] - [2 [:map [:y [:= 2]]]]] - [:map [:x :int]] - [:map [:z :int]] - [:multi {:dispatch :y} - [3 [:map [:y [:= 3]]]] - [4 [:map [:y [:= 4]]]]]]) + [:merge + [:multi {:dispatch :y} + [1 [:map [:y [:= 1]]]] + [2 [:map [:y [:= 2]]]]] + [:map [:x :int]] + [:map [:z :int]] + [:multi {:dispatch :y} + [3 [:map [:y [:= 3]]]] + [4 [:map [:y [:= 4]]]]]]) (dist + [:merge [:merge [:merge - [:merge - [:multi {:dispatch :y} - [1 [:map [:y [:= 1]]]] - [2 [:map [:y [:= 2]]]]] - [:map [:x :int]]] - [:map [:z :int]]] [:multi {:dispatch :y} - [3 [:map [:y [:= 3]]]] - [4 [:map [:y [:= 4]]]]]]) + [1 [:map [:y [:= 1]]]] + [2 [:map [:y [:= 2]]]]] + [:map [:x :int]]] + [:map [:z :int]]] + [:multi {:dispatch :y} + [3 [:map [:y [:= 3]]]] + [4 [:map [:y [:= 4]]]]]]) [:multi {:dispatch :y} [1 [:multi {:dispatch :y} [3 [:map [:y [:= 3]] [:x :int] [:z :int]]] @@ -91,15 +91,15 @@ [3 [:map [:y [:= 3]] [:x :int] [:z :int]]] [4 [:map [:y [:= 4]] [:x :int] [:z :int]]]]]])) (is (= (dist - [:merge - [:multi {:dispatch :y} - [1 [:map [:y [:= 1]]]] - [2 [:map [:y [:= 2]]]]] - [:map [:x :int]] - [:map [:z :int]] - [:multi {:dispatch :a} - [3 [:map [:a [:= 3]]]] - [4 [:map [:a [:= 4]]]]]]) + [:merge + [:multi {:dispatch :y} + [1 [:map [:y [:= 1]]]] + [2 [:map [:y [:= 2]]]]] + [:map [:x :int]] + [:map [:z :int]] + [:multi {:dispatch :a} + [3 [:map [:a [:= 3]]]] + [4 [:map [:a [:= 4]]]]]]) [:multi {:dispatch :y} [1 [:multi {:dispatch :a} [3 [:map [:y [:= 1]] [:x :int] [:z :int] [:a [:= 3]]]] @@ -108,13 +108,13 @@ [3 [:map [:y [:= 2]] [:x :int] [:z :int] [:a [:= 3]]]] [4 [:map [:y [:= 2]] [:x :int] [:z :int] [:a [:= 4]]]]]]])) (is (= (dist - [:merge - [:multi {:dispatch :y} - [1 [:map [:y [:= 1]]]] - [2 [:map [:y [:= 2]]]]] - [:multi {:dispatch :y} - [3 [:map [:y [:= 3]]]] - [4 [:map [:y [:= 4]]]]]]) + [:merge + [:multi {:dispatch :y} + [1 [:map [:y [:= 1]]]] + [2 [:map [:y [:= 2]]]]] + [:multi {:dispatch :y} + [3 [:map [:y [:= 3]]]] + [4 [:map [:y [:= 4]]]]]]) [:multi {:dispatch :y} [1 [:multi {:dispatch :y} [3 [:map [:y [:= 3]]]] @@ -123,13 +123,13 @@ [3 [:map [:y [:= 3]]]] [4 [:map [:y [:= 4]]]]]]])) (is (= (dist - [:merge - [:multi {:dispatch :y} - [1 [:map [:y [:= 1]]]] - [2 [:map [:y [:= 2]]]]] - [:multi {:dispatch :z} - [3 [:map [:z [:= 3]]]] - [4 [:map [:z [:= 4]]]]]]) + [:merge + [:multi {:dispatch :y} + [1 [:map [:y [:= 1]]]] + [2 [:map [:y [:= 2]]]]] + [:multi {:dispatch :z} + [3 [:map [:z [:= 3]]]] + [4 [:map [:z [:= 4]]]]]]) [:multi {:dispatch :y} [1 [:multi {:dispatch :z} [3 [:map [:y [:= 1]] [:z [:= 3]]]] @@ -141,25 +141,25 @@ (deftest parse-distributive-multi-test (is (= [1 [3 {:y 1, :z 3}]] (m/parse - [:merge - [:multi {:dispatch :y} - [1 [:map [:y [:= 1]]]] - [2 [:map [:y [:= 2]]]]] - [:multi {:dispatch :z} - [3 [:map [:z [:= 3]]]] - [4 [:map [:z [:= 4]]]]]] - {:y 1 :z 3} - options)))) + [:merge + [:multi {:dispatch :y} + [1 [:map [:y [:= 1]]]] + [2 [:map [:y [:= 2]]]]] + [:multi {:dispatch :z} + [3 [:map [:z [:= 3]]]] + [4 [:map [:z [:= 4]]]]]] + {:y 1 :z 3} + options)))) (deftest gen-distributive-multi-test (is (= [{:y 1, :z 3} {:y 2, :z 4} {:y 2, :z 3} {:y 2, :z 3} {:y 1, :z 4} {:y 1, :z 3} {:y 1, :z 3} {:y 1, :z 3} {:y 1, :z 3} {:y 2, :z 4}] (mg/sample - [:merge - [:multi {:dispatch :y} - [1 [:map [:y [:= 1]]]] - [2 [:map [:y [:= 2]]]]] - [:multi {:dispatch :z} - [3 [:map [:z [:= 3]]]] - [4 [:map [:z [:= 4]]]]]] - (assoc options :seed 0))))) + [:merge + [:multi {:dispatch :y} + [1 [:map [:y [:= 1]]]] + [2 [:map [:y [:= 2]]]]] + [:multi {:dispatch :z} + [3 [:map [:z [:= 3]]]] + [4 [:map [:z [:= 4]]]]]] + (assoc options :seed 0))))) diff --git a/test/malli/error_test.cljc b/test/malli/error_test.cljc index ad9923fcb..c17ed315a 100644 --- a/test/malli/error_test.cljc +++ b/test/malli/error_test.cljc @@ -52,7 +52,7 @@ (is (= [{:path ["deliverz"] :type ::me/misspelled-key ::me/likely-misspelling-of [["deliver"]] - :message #?(:clj "should be spelled \"deliver\"" + :message #?(:clj "should be spelled \"deliver\"" :cljs "should be spelled deliver")}] (-> [:map ["orders" boolean?] @@ -389,12 +389,12 @@ [:e [t {:min 1, :max 4}]] [:f [t {:min 4, :max 4}]]] (m/explain - {:a "123" - :b 0.0 - :c 5.0 - :d [0.0 5.0] - :e "123" - :f 5.0}) + {:a "123" + :b 0.0 + :c 5.0 + :d [0.0 5.0] + :e "123" + :f 5.0}) (me/humanize)))))) (deftest any-test @@ -435,24 +435,24 @@ (m/explain "foo") (me/humanize))))) (testing "error with 1 value" - (is (= [#?(:clj "should be \"foo\"" + (is (= [#?(:clj "should be \"foo\"" :cljs "should be foo")] (-> [:enum "foo"] (m/explain "baz") (me/humanize))))) (testing "error with 2 values" - (is (= [#?(:clj "should be either \"foo\" or \"bar\"" + (is (= [#?(:clj "should be either \"foo\" or \"bar\"" :cljs "should be either foo or bar")] (-> [:enum "foo" "bar"] (m/explain "baz") (me/humanize))))) (testing "more than 2 values" - (is (= [#?(:clj "should be either \"foo\", \"bar\", bar or \"buzz\"" + (is (= [#?(:clj "should be either \"foo\", \"bar\", bar or \"buzz\"" :cljs "should be either foo, bar, bar or buzz")] (-> [:enum "foo" "bar" 'bar "buzz"] (m/explain "baz") (me/humanize)))) - (is (= [#?(:clj "should be either \"foo\", \"bar\", \"buzz\" or \"biff\"" + (is (= [#?(:clj "should be either \"foo\", \"bar\", \"buzz\" or \"biff\"" :cljs "should be either foo, bar, buzz or biff")] (-> [:enum "foo" "bar" "buzz" "biff"] (m/explain "baz") @@ -485,7 +485,7 @@ (m/explain {:type "minuz"}) (me/humanize)))) - (is (= {:type [#?(:clj "did you mean \"minus\" or minus" + (is (= {:type [#?(:clj "did you mean \"minus\" or minus" :cljs "did you mean minus or minus")]} (-> schema (m/explain {:type "minuz"}) @@ -573,7 +573,7 @@ (me/humanize {:resolve me/-resolve-root-error}))))) (testing "enum #553" - (is (= {:a [#?(:clj "should be either \"a\", \"b\", a or b" + (is (= {:a [#?(:clj "should be either \"a\", \"b\", a or b" :cljs "should be either a, b, a or b")]} (-> [:map [:a [:enum "a" "b" 'a 'b]]] @@ -821,10 +821,10 @@ (is (= ["should not be a simple symbol"] (me/humanize (m/explain [:not simple-symbol?] 'a)))) (is (= ["should not be a qualified symbol"] (me/humanize (m/explain [:not qualified-symbol?] `a)))) (is (= ["should not be a uuid"] (me/humanize (m/explain [:not uuid?] (random-uuid))))) - (is (= ["should not be a uri"] (me/humanize (m/explain [:not uri?] (#?(:clj java.net.URI. - :cljs Uri. + (is (= ["should not be a uri"] (me/humanize (m/explain [:not uri?] (#?(:clj java.net.URI. + :cljs Uri. :default (throw (ex-info "Create URI" {}))) - "http://asdf.com"))))) + "http://asdf.com"))))) #?(:clj (is (= ["should not be a decimal"] (me/humanize (m/explain [:not decimal?] 1M))))) (is (= ["should not be an inst"] (me/humanize (m/explain [:not inst?] #inst "2018-04-27T18:25:37Z")))) (is (= ["should not be seqable"] (me/humanize (m/explain [:not seqable?] nil)))) @@ -881,35 +881,35 @@ (deftest nested-not-humanize-test (testing ":=" - (is (= ["should be 1"] (me/humanize (m/explain [:= 1] nil)))) + (is (= ["should be 1"] (me/humanize (m/explain [:= 1] nil)))) (is (= ["should not be 1"] (me/humanize (m/explain [:not [:= 1]] 1)))) - (is (= ["should be 1"] (me/humanize (m/explain [:not [:not [:= 1]]] nil)))) + (is (= ["should be 1"] (me/humanize (m/explain [:not [:not [:= 1]]] nil)))) (is (= ["should not be 1"] (me/humanize (m/explain [:not [:not [:not [:= 1]]]] 1)))) - (is (= ["should be 1"] (me/humanize (m/explain [:not [:not [:not [:not [:= 1]]]]] nil))))) + (is (= ["should be 1"] (me/humanize (m/explain [:not [:not [:not [:not [:= 1]]]]] nil))))) (testing ":>" (is (= ["should be larger than 1"] (me/humanize (m/explain [:> 1] 0)))) - (is (= ["should be at most 1"] (me/humanize (m/explain [:not [:> 1]] 2)))) + (is (= ["should be at most 1"] (me/humanize (m/explain [:not [:> 1]] 2)))) (is (= ["should be larger than 1"] (me/humanize (m/explain [:not [:not [:> 1]]] 0)))) - (is (= ["should be at most 1"] (me/humanize (m/explain [:not [:not [:not [:> 1]]]] 2)))) + (is (= ["should be at most 1"] (me/humanize (m/explain [:not [:not [:not [:> 1]]]] 2)))) (is (= ["should be larger than 1"] (me/humanize (m/explain [:not [:not [:not [:not [:> 1]]]]] 0))))) (testing ":>=" - (is (= ["should be at least 1"] (me/humanize (m/explain [:>= 1] 0)))) + (is (= ["should be at least 1"] (me/humanize (m/explain [:>= 1] 0)))) (is (= ["should be smaller than 1"] (me/humanize (m/explain [:not [:>= 1]] 2)))) - (is (= ["should be at least 1"] (me/humanize (m/explain [:not [:not [:>= 1]]] 0)))) + (is (= ["should be at least 1"] (me/humanize (m/explain [:not [:not [:>= 1]]] 0)))) (is (= ["should be smaller than 1"] (me/humanize (m/explain [:not [:not [:not [:>= 1]]]] 2)))) - (is (= ["should be at least 1"] (me/humanize (m/explain [:not [:not [:not [:not [:>= 1]]]]] 0))))) + (is (= ["should be at least 1"] (me/humanize (m/explain [:not [:not [:not [:not [:>= 1]]]]] 0))))) (testing ":<" (is (= ["should be smaller than 1"] (me/humanize (m/explain [:< 1] 2)))) - (is (= ["should be at least 1"] (me/humanize (m/explain [:not [:< 1]] 0)))) + (is (= ["should be at least 1"] (me/humanize (m/explain [:not [:< 1]] 0)))) (is (= ["should be smaller than 1"] (me/humanize (m/explain [:not [:not [:< 1]]] 2)))) - (is (= ["should be at least 1"] (me/humanize (m/explain [:not [:not [:not [:< 1]]]] 0)))) + (is (= ["should be at least 1"] (me/humanize (m/explain [:not [:not [:not [:< 1]]]] 0)))) (is (= ["should be smaller than 1"] (me/humanize (m/explain [:not [:not [:not [:not [:< 1]]]]] 2))))) (testing ":<=" - (is (= ["should be at most 1"] (me/humanize (m/explain [:<= 1] 2)))) + (is (= ["should be at most 1"] (me/humanize (m/explain [:<= 1] 2)))) (is (= ["should be larger than 1"] (me/humanize (m/explain [:not [:<= 1]] 0)))) - (is (= ["should be at most 1"] (me/humanize (m/explain [:not [:not [:<= 1]]] 2)))) + (is (= ["should be at most 1"] (me/humanize (m/explain [:not [:not [:<= 1]]] 2)))) (is (= ["should be larger than 1"] (me/humanize (m/explain [:not [:not [:not [:<= 1]]]] 0)))) - (is (= ["should be at most 1"] (me/humanize (m/explain [:not [:not [:not [:not [:<= 1]]]]] 2)))))) + (is (= ["should be at most 1"] (me/humanize (m/explain [:not [:not [:not [:not [:<= 1]]]]] 2)))))) (deftest custom-negating-test (is (= ["should be a multiple of 3"] @@ -922,7 +922,7 @@ #(not= 0 (mod % 3))] 0)))) (is (= ["should be a multiple of 3 negating=true"] (me/humanize (m/explain [:not [:fn {:error/fn {:en (fn [{:keys [negated]} _] (str "should not be a multiple of 3 negating=" - (boolean negated)))}} + (boolean negated)))}} #(not= 0 (mod % 3))]] 1)))) (testing ":negated disables implicit negation" (is (= ["should not avoid being a multiple of 3"] diff --git a/test/malli/experimental/time_test.cljc b/test/malli/experimental/time_test.cljc index ef2d97fc6..534d7ca62 100644 --- a/test/malli/experimental/time_test.cljc +++ b/test/malli/experimental/time_test.cljc @@ -65,36 +65,36 @@ not))) (t/testing "Period" (t/is (-> [:time/period {:min (. Period ofYears 9) :max (. Period ofYears 10)}] - (m/validate (. Period ofYears 10) {:registry r}))) + (m/validate (. Period ofYears 10) {:registry r}))) (t/is (-> [:time/period {:min (. Period ofMonths 9) :max (. Period ofMonths 10)}] - (m/validate (. Period ofMonths 12) {:registry r}) - not)) + (m/validate (. Period ofMonths 12) {:registry r}) + not)) (t/is (-> [:time/period {:min (. Period ofMonths 9) :max (. Period ofMonths 10)}] - (m/validate (. Period ofDays 12) {:registry r}) - not)) + (m/validate (. Period ofDays 12) {:registry r}) + not)) (t/is (-> [:time/period {:min (. Period ofYears 9)}] - (m/validate (. Period ofYears 9) {:registry r}))) + (m/validate (. Period ofYears 9) {:registry r}))) (t/is (-> [:time/period {:min (. Period ofYears 9)}] - (m/validate (. Period ofYears 10) {:registry r}))) + (m/validate (. Period ofYears 10) {:registry r}))) (t/is (-> [:time/period {:min (. Period ofYears 9)}] - (m/validate (. Period ofYears 8) {:registry r}) - not)) + (m/validate (. Period ofYears 8) {:registry r}) + not)) (t/is (-> [:time/period {:min (. Period of 0 10 2)}] - (m/validate (. Period of 1 9 3) {:registry r}))) + (m/validate (. Period of 1 9 3) {:registry r}))) (t/is (-> [:time/period {:max (. Period ofYears 9)}] - (m/validate (. Period ofYears 9) {:registry r}))) + (m/validate (. Period ofYears 9) {:registry r}))) (t/is (-> [:time/period {:max (. Period ofYears 9)}] - (m/validate (. Period ofYears 8) {:registry r}))) + (m/validate (. Period ofYears 8) {:registry r}))) (t/is (-> [:time/period {:max (. Period ofYears 9)}] - (m/validate (. Period ofDays 8) {:registry r}))) + (m/validate (. Period ofDays 8) {:registry r}))) (t/is (-> [:time/period {:max (. Period ofYears 1)}] - (m/validate (. Period ofMonths 23) {:registry r}))) + (m/validate (. Period ofMonths 23) {:registry r}))) (t/is (-> [:time/period {:max (. Period ofYears 9)}] - (m/validate (. Period ofYears 10) {:registry r}) - not)) + (m/validate (. Period ofYears 10) {:registry r}) + not)) (t/is (-> [:time/period {:max (. Period of 0 10 2)}] - (m/validate (. Period of 1 9 3) {:registry r}) - not))) + (m/validate (. Period of 1 9 3) {:registry r}) + not))) (t/testing "local date" (t/is (-> [:time/local-date {:min (. LocalDate parse "2020-01-01") :max (. LocalDate parse "2020-01-03")}] (m/validate (. LocalDate parse "2020-01-01") {:registry r}))) diff --git a/test/malli/generator_test.cljc b/test/malli/generator_test.cljc index 18afaa9fa..835a4f6f2 100644 --- a/test/malli/generator_test.cljc +++ b/test/malli/generator_test.cljc @@ -58,7 +58,7 @@ NaN? (fn [x] (#?(:clj Double/isNaN :cljs js/isNaN) - x)) + x)) special? #(or (NaN? %) (infinity? %)) valid? (m/validator s) @@ -984,7 +984,7 @@ (defn alphanumeric-char? [c] {:pre [(char? c)]} (let [int (fn [c] - #?(:clj (int c) + #?(:clj (int c) :cljs (.charCodeAt c 0))) i (int c)] (or (<= (int \a) i (int \z)) diff --git a/test/malli/instrument_test.clj b/test/malli/instrument_test.clj index 87be0f3e0..7f85c037a 100644 --- a/test/malli/instrument_test.clj +++ b/test/malli/instrument_test.clj @@ -120,9 +120,9 @@ (m/=> reinstrumented [:-> [:= 2]]) (instrument!) (is (thrown-with-msg? - Exception - #":malli\.core/invalid-output" - (reinstrumented))) + Exception + #":malli\.core/invalid-output" + (reinstrumented))) (m/=> reinstrumented [:-> [:= 1]]) (instrument!) (is (= 1 (reinstrumented)))) diff --git a/test/malli/registry_test.cljc b/test/malli/registry_test.cljc index 6b5e8d874..db0ecfd9e 100644 --- a/test/malli/registry_test.cljc +++ b/test/malli/registry_test.cljc @@ -13,10 +13,10 @@ (is (true? (m/validate :str "kikka" {:registry registry})))) (register! ::int-pair (m/schema [:tuple :int :int])) (is (thrown-with-msg? - #?(:clj Exception, :cljs js/Error) - #?(:clj #":malli\.core/infinitely-expanding-schema" - :cljs #":malli\.core/invalid-schema") - (m/schema [::int-pair {:foo :bar}] {:registry registry}))))) + #?(:clj Exception, :cljs js/Error) + #?(:clj #":malli\.core/infinitely-expanding-schema" + :cljs #":malli\.core/invalid-schema") + (m/schema [::int-pair {:foo :bar}] {:registry registry}))))) (deftest composite-test (let [registry* (atom {}) diff --git a/test/malli/util_test.cljc b/test/malli/util_test.cljc index be7e7ac6e..c0690260f 100644 --- a/test/malli/util_test.cljc +++ b/test/malli/util_test.cljc @@ -1099,28 +1099,28 @@ (is (= {:name "kikka" :description "kikka"} (m/decode - [:map - [:name [:string {:default "kikka"}]] - [:description {:optional true} [:string {:default "kikka"}]] ] - {} - {:registry (merge (mu/schemas) (m/default-schemas))} - (mt/default-value-transformer {::mt/add-optional-keys true})) + [:map + [:name [:string {:default "kikka"}]] + [:description {:optional true} [:string {:default "kikka"}]]] + {} + {:registry (merge (mu/schemas) (m/default-schemas))} + (mt/default-value-transformer {::mt/add-optional-keys true})) (m/decode - [:merge - [:map [:name [:string {:default "kikka"}]] ] - [:map [:description {:optional true} [:string {:default "kikka"}]]]] - {} - {:registry (merge (mu/schemas) (m/default-schemas))} - (mt/default-value-transformer {::mt/add-optional-keys true}))))) + [:merge + [:map [:name [:string {:default "kikka"}]]] + [:map [:description {:optional true} [:string {:default "kikka"}]]]] + {} + {:registry (merge (mu/schemas) (m/default-schemas))} + (mt/default-value-transformer {::mt/add-optional-keys true}))))) (deftest -reducing-test (is (= :map (m/form (m/deref-all (m/schema [:merge [:merge :map]] {:registry (merge (mu/schemas) (m/default-schemas))}))))) (is (= :map (m/form (m/deref-all (m/schema [:union [:union :map]] {:registry (merge (mu/schemas) (m/default-schemas))}))))) (is (thrown-with-msg? - #?(:clj Exception, :cljs js/Error) - #":malli\.core/child-error" - (m/schema :merge {:registry (merge (mu/schemas) (m/default-schemas))}))) + #?(:clj Exception, :cljs js/Error) + #":malli\.core/child-error" + (m/schema :merge {:registry (merge (mu/schemas) (m/default-schemas))}))) (is (thrown-with-msg? - #?(:clj Exception, :cljs js/Error) - #":malli\.core/child-error" - (m/schema :union {:registry (merge (mu/schemas) (m/default-schemas))})))) + #?(:clj Exception, :cljs js/Error) + #":malli\.core/child-error" + (m/schema :union {:registry (merge (mu/schemas) (m/default-schemas))}))))