aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/emacs-lisp/seq.el5
-rw-r--r--test/lisp/emacs-lisp/seq-tests.el4
2 files changed, 7 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el
index 20610a7027d..e5004f8cdab 100644
--- a/lisp/emacs-lisp/seq.el
+++ b/lisp/emacs-lisp/seq.el
@@ -4,7 +4,7 @@
4 4
5;; Author: Nicolas Petton <nicolas@petton.fr> 5;; Author: Nicolas Petton <nicolas@petton.fr>
6;; Keywords: sequences 6;; Keywords: sequences
7;; Version: 2.17 7;; Version: 2.18
8;; Package: seq 8;; Package: seq
9 9
10;; Maintainer: emacs-devel@gnu.org 10;; Maintainer: emacs-devel@gnu.org
@@ -349,7 +349,8 @@ found or not."
349 "Return the first element in SEQUENCE that is equal to ELT. 349 "Return the first element in SEQUENCE that is equal to ELT.
350Equality is defined by TESTFN if non-nil or by `equal' if nil." 350Equality is defined by TESTFN if non-nil or by `equal' if nil."
351 (seq-some (lambda (e) 351 (seq-some (lambda (e)
352 (funcall (or testfn #'equal) elt e)) 352 (when (funcall (or testfn #'equal) elt e)
353 e))
353 sequence)) 354 sequence))
354 355
355(cl-defgeneric seq-position (sequence elt &optional testfn) 356(cl-defgeneric seq-position (sequence elt &optional testfn)
diff --git a/test/lisp/emacs-lisp/seq-tests.el b/test/lisp/emacs-lisp/seq-tests.el
index b227de36e97..c2065c6718f 100644
--- a/test/lisp/emacs-lisp/seq-tests.el
+++ b/test/lisp/emacs-lisp/seq-tests.el
@@ -181,6 +181,10 @@ Evaluate BODY for each created sequence.
181 (should-not (seq-contains seq 3)) 181 (should-not (seq-contains seq 3))
182 (should-not (seq-contains seq nil)))) 182 (should-not (seq-contains seq nil))))
183 183
184(ert-deftest test-seq-contains-should-return-the-elt ()
185 (with-test-sequences (seq '(3 4 5 6))
186 (should (= 5 (seq-contains seq 5)))))
187
184(ert-deftest test-seq-every-p () 188(ert-deftest test-seq-every-p ()
185 (with-test-sequences (seq '(43 54 22 1)) 189 (with-test-sequences (seq '(43 54 22 1))
186 (should (seq-every-p (lambda (elt) t) seq)) 190 (should (seq-every-p (lambda (elt) t) seq))