Support predicate checks within a collection with =?
Nobody has claimed this yet.
- Dominant language
- Clojure
- Stars
- 60
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
```
(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](https://github.com/metabase/metabase/blob/f50d839f6dcdda71dc865cc48fb20bda7193650a/test/metabase/api/table_test.clj#L146)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Search the implementation and tests for `=?`, then reproduce the shown `deftest` cases, especially the set containing `even?`. Confirm the desired behavior for a collection with one predicate: its type must match and every actual element must satisfy the predicate; the collection case should pass without changing the existing scalar and map cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100