summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp/seq-tests.el
diff options
context:
space:
mode:
authorDamien Cassou <damien@cassou.me>2022-09-03 18:47:04 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-09-04 13:07:18 +0200
commit2db8b0e12f913ecd720aa81a70580e58fd032397 (patch)
tree512b4e3f032fcdb2a80f1e36dcabc696c9311abe /test/lisp/emacs-lisp/seq-tests.el
parent77b761dafaf65d57dd05ecd586884340fa4e63e2 (diff)
downloademacs-2db8b0e12f913ecd720aa81a70580e58fd032397.tar.gz
emacs-2db8b0e12f913ecd720aa81a70580e58fd032397.tar.bz2
emacs-2db8b0e12f913ecd720aa81a70580e58fd032397.zip
Add new function `seq-remove-at-position'
* doc/lispref/sequences.texi (Sequence Functions): Document it. * lisp/emacs-lisp/seq.el (seq-remove-at-position): New function. * lisp/emacs-lisp/shortdoc.el (sequence): Mention it. * test/lisp/emacs-lisp/seq-tests.el (test-seq-remove-at-position): Test it.
Diffstat (limited to 'test/lisp/emacs-lisp/seq-tests.el')
-rw-r--r--test/lisp/emacs-lisp/seq-tests.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/seq-tests.el b/test/lisp/emacs-lisp/seq-tests.el
index 1a27467d292..6249e486173 100644
--- a/test/lisp/emacs-lisp/seq-tests.el
+++ b/test/lisp/emacs-lisp/seq-tests.el
@@ -137,6 +137,14 @@ Evaluate BODY for each created sequence.
(with-test-sequences (seq '())
(should (equal (seq-remove #'test-sequences-evenp seq) '()))))
+(ert-deftest test-seq-remove-at-position ()
+ (with-test-sequences (seq '(1 2 3 4))
+ (should (same-contents-p (seq-remove-at-position seq 2) '(1 2 4)))
+ (should (same-contents-p (seq-remove-at-position seq 0) '(2 3 4)))
+ (should (same-contents-p (seq-remove-at-position seq 3) '(1 2 3)))
+ (should (eq (type-of (seq-remove-at-position seq 2))
+ (type-of seq)))))
+
(ert-deftest test-seq-count ()
(with-test-sequences (seq '(6 7 8 9 10))
(should (equal (seq-count #'test-sequences-evenp seq) 3))