nubank / matcher-combinators

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

`absent` doesn't work with `any-of` #211

Open kkrausse opened 1 year ago

kkrausse commented 1 year ago

since this works:

(matcher-combinators.standalone/match?
 {:a matcher-combinators.matchers/absent}
 {:c 'd})
;; => true

I would expect that

(matcher-combinators.standalone/match?
 {:a (matcher-combinators.matchers/any-of
      'b
      matcher-combinators.matchers/absent)}
 {:c 'd})
;; => true

also, but actually it gives false. Using version 3.8.5.

philomates commented 1 year ago

Hi, yes this seems to be a bug in the implementation. absent is implemented in a sort of tricky way but I think we can try tracking when an any-of has an absent entry and change the behavior to include the option of an absent match. I'll poke around and see if I can get this rolling