diff options
| author | Nicolas Petton | 2016-02-14 10:25:10 +0100 |
|---|---|---|
| committer | Nicolas Petton | 2016-02-14 10:25:10 +0100 |
| commit | 30fe90fa3c8f814a30a5136089b995b0a26f5cd0 (patch) | |
| tree | 6854e323308d2e2790119ffb47d9d97ec8a2a056 /test | |
| parent | d9bf0c1c6a6ce90aa2edbb911fb58b26975d423b (diff) | |
| download | emacs-30fe90fa3c8f814a30a5136089b995b0a26f5cd0.tar.gz emacs-30fe90fa3c8f814a30a5136089b995b0a26f5cd0.zip | |
New function seq-map-indexed
* lisp/emacs-lisp/seq.el (seq-map-indexed): New function.
* test/lisp/emacs-lisp/seq-tests.el: Add tests for seq-map-indexed.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/emacs-lisp/seq-tests.el | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/seq-tests.el b/test/lisp/emacs-lisp/seq-tests.el index a8ca48b1328..c9219b51d00 100644 --- a/test/lisp/emacs-lisp/seq-tests.el +++ b/test/lisp/emacs-lisp/seq-tests.el | |||
| @@ -97,6 +97,16 @@ Evaluate BODY for each created sequence. | |||
| 97 | (with-test-sequences (seq '()) | 97 | (with-test-sequences (seq '()) |
| 98 | (should (seq-empty-p (seq-take-while #'test-sequences-oddp seq))))) | 98 | (should (seq-empty-p (seq-take-while #'test-sequences-oddp seq))))) |
| 99 | 99 | ||
| 100 | (ert-deftest test-seq-map-indexed () | ||
| 101 | (should (equal (seq-map-indexed (lambda (elt i) | ||
| 102 | (list elt i)) | ||
| 103 | nil) | ||
| 104 | nil)) | ||
| 105 | (should (equal (seq-map-indexed (lambda (elt i) | ||
| 106 | (list elt i)) | ||
| 107 | '(a b c d)) | ||
| 108 | '((a 0) (b 1) (c 2) (d 3))))) | ||
| 109 | |||
| 100 | (ert-deftest test-seq-filter () | 110 | (ert-deftest test-seq-filter () |
| 101 | (with-test-sequences (seq '(6 7 8 9 10)) | 111 | (with-test-sequences (seq '(6 7 8 9 10)) |
| 102 | (should (equal (seq-filter #'test-sequences-evenp seq) '(6 8 10))) | 112 | (should (equal (seq-filter #'test-sequences-evenp seq) '(6 8 10))) |