Skip to content

Commit

Permalink
Merge pull request #1101 from metosin/fix/some-pred
Browse files Browse the repository at this point in the history
fix: (-some-pred []) should return false
  • Loading branch information
ikitommi authored Aug 28, 2024
2 parents 50da02b + 20d0efd commit b91fc18
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/clojure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ jobs:
uses: DeLaGuardo/setup-clojure@master
with:
cli: latest
# bb: latest
- name: Download bb master
run: bash <(curl -s https://raw.githubusercontent.com/babashka/babashka/master/install) --version 0.8.157-SNAPSHOT
bb: latest
- name: Run tests
run: bb test-bb
2 changes: 1 addition & 1 deletion src/malli/impl/util.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
(fn [x#] (~c (p# x#) (q# x#))))]
`(fn ~f [~preds]
(case (count ~preds)
0 (constantly true)
0 (constantly (boolean (~c)))
1 (first ~preds)
~@cases
~else)))))
Expand Down
5 changes: 4 additions & 1 deletion test/malli/util_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,10 @@
(is (true? ((miu/-some-pred tf) nil)))
(is (true? ((miu/-some-pred ft) nil)))
(is (false? ((miu/-some-pred ff) nil)))
(is (true? ((miu/-some-pred tt) nil)))))))
(is (true? ((miu/-some-pred tt) nil))))
(testing "empty inputs"
(is (true? ((miu/-every-pred []) :anything)))
(is (false? ((miu/-some-pred []) :anything)))))))

(deftest explain-data-test
(let [schema (m/schema [:map [:a [:vector [:maybe :string]]]])
Expand Down

0 comments on commit b91fc18

Please sign in to comment.