From 830d4d55eaad715aa327ba18a4ff1fc271740e44 Mon Sep 17 00:00:00 2001 From: Christian Paul Dehli Date: Sat, 13 Nov 2021 04:30:48 -0500 Subject: [PATCH] Fix bug with ds/or spec generation Closes #264 --- test/cljc/spec_tools/core_test.cljc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/cljc/spec_tools/core_test.cljc b/test/cljc/spec_tools/core_test.cljc index bbc2a70..a02cae8 100644 --- a/test/cljc/spec_tools/core_test.cljc +++ b/test/cljc/spec_tools/core_test.cljc @@ -928,3 +928,18 @@ {:epoch "Epoch converted" :nano 20 :time-basis :UTC}))))) + +(s/def ::str-264 string?) +(s/def ::kw-264 keyword?) +(s/def ::map-264 (s/or :str-map (s/keys :req [::str-264]) + :kw-map (s/keys :req [::kw-264]))) + +(deftest issue-264 + (doseq [check [{::kw-264 :foo} + {::str-264 "bar"}]] + + (testing "spec was created properly" + (is (s/valid? ::map-264 check))) + + (testing "valid spec doesn't have keys stripped out" + (is (= check (st/select-spec ::map-264 check))))))