Skip to content

Support predicate checks within a collection with =?  #23

Description

@tsmacdonald
(deftest foo-test
  (is (=? even? 4)) ; passes
  (is (=? {:foo even?} {:foo 42})) ; passes
  (is (=? #{even?} #{2 4 6 8})))  ; fails: expected #{even?}, actual #{2 4 6 8}

If there's a collection that includes exactly one item which is a predicate function, I think =? should check that the actual value is of the given collection type and all of its elements pass the predicate.

Motivating example in the wild from Metabase

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions