diff options
| author | Nicolas Petton | 2018-12-18 09:42:50 +0100 |
|---|---|---|
| committer | Nicolas Petton | 2018-12-18 09:42:50 +0100 |
| commit | 5a9eba603d193324c7ff8c654fa28c6b4f3928f7 (patch) | |
| tree | da277418a4a17987e8ba30642de863f09b9f5bc1 /test | |
| parent | 73b2f7ac698601d3dfbedd7949d95bc506497c50 (diff) | |
| download | emacs-5a9eba603d193324c7ff8c654fa28c6b4f3928f7.tar.gz emacs-5a9eba603d193324c7ff8c654fa28c6b4f3928f7.zip | |
New convenience functions in seq.el
Functions to access the first or all but the first elements of
sequences have been repeatedly asked for (the last occurrence being
https://github.com/NicolasPetton/seq.el/issues/9).
* lisp/emacs-lisp/seq.el (seq-first, seq-rest): New functions.
* test/lisp/emacs-lisp/seq-tests.el (test-seq-first, test-seq-rest):
New tests for seq-first and seq-rest.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/emacs-lisp/seq-tests.el | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/seq-tests.el b/test/lisp/emacs-lisp/seq-tests.el index 989ec3cf9e0..0f11bd9714c 100644 --- a/test/lisp/emacs-lisp/seq-tests.el +++ b/test/lisp/emacs-lisp/seq-tests.el | |||
| @@ -424,5 +424,17 @@ Evaluate BODY for each created sequence. | |||
| 424 | (should (eq (seq-into vec 'vector) vec)) | 424 | (should (eq (seq-into vec 'vector) vec)) |
| 425 | (should (eq (seq-into str 'string) str)))) | 425 | (should (eq (seq-into str 'string) str)))) |
| 426 | 426 | ||
| 427 | (ert-deftest test-seq-first () | ||
| 428 | (let ((lst '(1 2 3)) | ||
| 429 | (vec [1 2 3])) | ||
| 430 | (should (eq (seq-first lst) 1)) | ||
| 431 | (should (eq (seq-first vec) 1)))) | ||
| 432 | |||
| 433 | (ert-deftest test-seq-rest () | ||
| 434 | (let ((lst '(1 2 3)) | ||
| 435 | (vec [1 2 3])) | ||
| 436 | (should (equal (seq-rest lst) '(2 3))) | ||
| 437 | (should (equal (seq-rest vec) [2 3])))) | ||
| 438 | |||
| 427 | (provide 'seq-tests) | 439 | (provide 'seq-tests) |
| 428 | ;;; seq-tests.el ends here | 440 | ;;; seq-tests.el ends here |