Add tests for find (#1808)

Co-authored-by: sogaiu <983021772@users.noreply.github.com>
This commit is contained in:
sogaiu
2026-08-17 07:55:40 -05:00
committed by GitHub
co-authored by sogaiu
parent 82b2bdc8e2
commit c6ca76044d
+10
View File
@@ -1064,4 +1064,14 @@
(assert (= (find-index pos? @[-2 -1 0 -3] :surprise!) :surprise!))
(assert (= (find-index zero? {:a 2 :b 1 :c 0}) :c))
# find
(assert (= (find |(= $ (chr "o")) "tomato") 111))
(assert (= (find |(= $ (chr "m")) "potato") nil))
(assert (= (find |(> $ (chr "y")) :ant :surprise) :surprise))
(assert (= (find pos? [-1 0 11]) 11))
(assert (= (find neg? @[0 1 2 3 5]) nil))
(assert (= (find one? {:a 1 :b 2}) 1))
(assert (= (find even? @{:x 11 :y 28 :z 33}) 28))
(assert (= (find keyword? (coro (yield 'jump) (yield :wave))) :wave))
(end-suite)