aboutsummaryrefslogtreecommitdiffstats
path: root/test/automated/seq-tests.el
diff options
context:
space:
mode:
Diffstat (limited to 'test/automated/seq-tests.el')
-rw-r--r--test/automated/seq-tests.el26
1 files changed, 25 insertions, 1 deletions
diff --git a/test/automated/seq-tests.el b/test/automated/seq-tests.el
index 23989799306..ecbc0043210 100644
--- a/test/automated/seq-tests.el
+++ b/test/automated/seq-tests.el
@@ -2,7 +2,7 @@
2 2
3;; Copyright (C) 2014-2015 Free Software Foundation, Inc. 3;; Copyright (C) 2014-2015 Free Software Foundation, Inc.
4 4
5;; Author: Nicolas Petton <petton.nicolas@gmail.com> 5;; Author: Nicolas Petton <nicolas@petton.fr>
6;; Maintainer: emacs-devel@gnu.org 6;; Maintainer: emacs-devel@gnu.org
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
@@ -197,5 +197,29 @@ Evaluate BODY for each created sequence.
197 (should (equal (seq-concatenate 'vector nil '(8 10)) [8 10])) 197 (should (equal (seq-concatenate 'vector nil '(8 10)) [8 10]))
198 (should (equal (seq-concatenate 'vector seq nil) [2 4 6])))) 198 (should (equal (seq-concatenate 'vector seq nil) [2 4 6]))))
199 199
200(ert-deftest test-seq-mapcat ()
201 (should (equal (seq-mapcat #'seq-reverse '((3 2 1) (6 5 4)))
202 '(1 2 3 4 5 6)))
203 (should (equal (seq-mapcat #'seq-reverse '[(3 2 1) (6 5 4)])
204 '(1 2 3 4 5 6)))
205 (should (equal (seq-mapcat #'seq-reverse '((3 2 1) (6 5 4)) 'vector)
206 '[1 2 3 4 5 6])))
207
208(ert-deftest test-seq-partition ()
209 (should (same-contents-p (seq-partition '(0 1 2 3 4 5 6 7) 3)
210 '((0 1 2) (3 4 5) (6 7))))
211 (should (same-contents-p (seq-partition '[0 1 2 3 4 5 6 7] 3)
212 '([0 1 2] [3 4 5] [6 7])))
213 (should (same-contents-p (seq-partition "Hello world" 2)
214 '("He" "ll" "o " "wo" "rl" "d")))
215 (should (equal (seq-partition '() 2) '()))
216 (should (equal (seq-partition '(1 2 3) -1) '())))
217
218(ert-deftest test-seq-group-by ()
219 (should (equal (seq-group-by #'test-sequences-oddp [1 2 3 4])
220 '((t 3 1) (nil 4 2))))
221 (should (equal (seq-group-by #'car '((a 1) (b 3) (c 4) (a 2)))
222 '((a (a 2) (a 1)) (b (b 3)) (c (c 4))))))
223
200(provide 'seq-tests) 224(provide 'seq-tests)
201;;; seq-tests.el ends here 225;;; seq-tests.el ends here