Skip to content

Commit b91fc18

Browse files
authored
Merge pull request #1101 from metosin/fix/some-pred
fix: (-some-pred []) should return false
2 parents 50da02b + 20d0efd commit b91fc18

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

.github/workflows/clojure.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ jobs:
102102
uses: DeLaGuardo/setup-clojure@master
103103
with:
104104
cli: latest
105-
# bb: latest
106-
- name: Download bb master
107-
run: bash <(curl -s https://raw.githubusercontent.com/babashka/babashka/master/install) --version 0.8.157-SNAPSHOT
105+
bb: latest
108106
- name: Run tests
109107
run: bb test-bb

src/malli/impl/util.cljc

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
(fn [x#] (~c (p# x#) (q# x#))))]
6161
`(fn ~f [~preds]
6262
(case (count ~preds)
63-
0 (constantly true)
63+
0 (constantly (boolean (~c)))
6464
1 (first ~preds)
6565
~@cases
6666
~else)))))

test/malli/util_test.cljc

+4-1
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,10 @@
946946
(is (true? ((miu/-some-pred tf) nil)))
947947
(is (true? ((miu/-some-pred ft) nil)))
948948
(is (false? ((miu/-some-pred ff) nil)))
949-
(is (true? ((miu/-some-pred tt) nil)))))))
949+
(is (true? ((miu/-some-pred tt) nil))))
950+
(testing "empty inputs"
951+
(is (true? ((miu/-every-pred []) :anything)))
952+
(is (false? ((miu/-some-pred []) :anything)))))))
950953

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

0 commit comments

Comments
 (0)