diff options
| author | Nicolas Petton | 2015-09-06 00:26:17 +0200 |
|---|---|---|
| committer | Nicolas Petton | 2015-09-06 00:44:39 +0200 |
| commit | aeb1d6bdd54671a2e2b7dfbd22fcfe1aa19b36d1 (patch) | |
| tree | 117e8f076fe9edb808781730f09122403855313d /test | |
| parent | c36663d866e64fcb4b0d94742009d84366e9b54f (diff) | |
| download | emacs-aeb1d6bdd54671a2e2b7dfbd22fcfe1aa19b36d1.tar.gz emacs-aeb1d6bdd54671a2e2b7dfbd22fcfe1aa19b36d1.zip | |
Improve the semantic of seq-some
Update seq-some to return non-nil if the predicate returns non-nil for
any element of the seq, in which case the returned value is the one
returned by the predicate.
* lisp/emacs-lisp/seq.el (seq-some): Update the function and its
docstring.
* test/automated/seq-tests.el (test-seq-some): Add a regression test.
* doc/lispref/sequences.texi (Sequence Functions): Update the
documentation for seq-some.
Diffstat (limited to 'test')
| -rw-r--r-- | test/automated/seq-tests.el | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/test/automated/seq-tests.el b/test/automated/seq-tests.el index efbb90dd988..07a183d024e 100644 --- a/test/automated/seq-tests.el +++ b/test/automated/seq-tests.el | |||
| @@ -131,11 +131,12 @@ Evaluate BODY for each created sequence. | |||
| 131 | 131 | ||
| 132 | (ert-deftest test-seq-some () | 132 | (ert-deftest test-seq-some () |
| 133 | (with-test-sequences (seq '(4 3 2 1)) | 133 | (with-test-sequences (seq '(4 3 2 1)) |
| 134 | (should (= (seq-some #'test-sequences-evenp seq) 4)) | 134 | (should (seq-some #'test-sequences-evenp seq)) |
| 135 | (should (= (seq-some #'test-sequences-oddp seq) 3)) | 135 | (should (seq-some #'test-sequences-oddp seq)) |
| 136 | (should-not (seq-some (lambda (elt) (> elt 10)) seq))) | 136 | (should-not (seq-some (lambda (elt) (> elt 10)) seq))) |
| 137 | (with-test-sequences (seq '()) | 137 | (with-test-sequences (seq '()) |
| 138 | (should-not (seq-some #'test-sequences-oddp seq)))) | 138 | (should-not (seq-some #'test-sequences-oddp seq))) |
| 139 | (should (seq-some #'null '(1 nil 2)))) | ||
| 139 | 140 | ||
| 140 | (ert-deftest test-seq-contains () | 141 | (ert-deftest test-seq-contains () |
| 141 | (with-test-sequences (seq '(3 4 5 6)) | 142 | (with-test-sequences (seq '(3 4 5 6)) |