nubank / matcher-combinators

Library for creating matcher combinator to compare nested data structures
Other
467 stars 23 forks source link

Use set matcher if the expected is a clojure set or a java set #125

Closed gabrielgiussi closed 4 years ago

gabrielgiussi commented 4 years ago

Solution for issue https://github.com/nubank/matcher-combinators/issues/116.

Clojure only recognizes IPersistentSet as set? because java.util.Set has no immutability semantic baked in. For the purposes of matching, we only need to read the sets, so this PR applies set matching semantics to instances of java.util.Set as well as clojure.lang.IPersistentSet.

fernando-nubank commented 4 years ago

Do you think it is a good solution for this issue to modify the predicate so it uses the set matcher if the expected value is a java set?

Makes sense to me - although I don't see anyone using a Java Set as expected value

dchelimsky commented 4 years ago

Makes sense to me - although I don't see anyone using a Java Set as expected value

Perhaps not when using a literal, but what if you're deriving the actual value from another function or a generator?