fix composing together something defined with comp-paths with other selectors in a comp-unoptimal setting
This commit is contained in:
parent
4aaf058bef
commit
5a6d3fe630
2 changed files with 26 additions and 2 deletions
|
|
@ -210,7 +210,7 @@
|
|||
(cond (structure-path? this) (coerce-structure-path-direct this)
|
||||
(obj-extends? Collector this) (coerce-collector this)
|
||||
(obj-extends? StructureValsPath this) (coerce-structure-vals-path this)
|
||||
(instance? TransformFunctions this) this
|
||||
(instance? TransformFunctions this) (coerce-structure-vals this)
|
||||
:else (throw-illegal (no-prot-error-str this))
|
||||
))
|
||||
|
||||
|
|
@ -220,7 +220,7 @@
|
|||
(defn comp-unoptimal [sp]
|
||||
(if (instance? java.util.List sp)
|
||||
(->> sp
|
||||
(map (fn [p] (-> p coerce-structure-vals-direct)))
|
||||
(map coerce-structure-vals-direct)
|
||||
combine-same-types)
|
||||
(coerce-path sp)))
|
||||
|
||||
|
|
|
|||
|
|
@ -271,3 +271,27 @@
|
|||
(update (comp-paths kw nil) inc m)
|
||||
(update (comp-paths nil kw nil) inc m)
|
||||
))))
|
||||
|
||||
(deftest compose-empty-comp-path-test
|
||||
(let [m {:a 1}]
|
||||
(is (= [1]
|
||||
(select [:a (comp-paths)] m)
|
||||
(select [(comp-paths) :a] m)
|
||||
))))
|
||||
|
||||
(defspec mixed-selector-test
|
||||
(for-all+
|
||||
[k1 (max-size 3 gen/keyword)
|
||||
k2 (max-size 3 gen/keyword)
|
||||
m (max-size 5
|
||||
(gen-map-with-keys
|
||||
gen/keyword
|
||||
(gen-map-with-keys gen/keyword gen/int k2)
|
||||
k1))]
|
||||
(= [(-> m k1 k2)]
|
||||
(select [k1 (comp-paths k2)] m)
|
||||
(select [(comp-paths k1) k2] m)
|
||||
(select [(comp-paths k1 k2) nil] m)
|
||||
(select [(comp-paths) k1 k2] m)
|
||||
(select [k1 (comp-paths) k2] m)
|
||||
)))
|
||||
|
|
|
|||
Loading…
Reference in a new issue