aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNicolas Petton2015-02-06 15:55:57 +0100
committerNicolas Petton2015-02-06 15:55:57 +0100
commitc4a0eff0112298de0a97b63e4e22826bf2b4126c (patch)
tree8cf3babd3fcb25769c6cd36a52bb7753b143bbe2 /test
parent05211a578ed2c52f6ed818fc173561afbaea54c2 (diff)
downloademacs-c4a0eff0112298de0a97b63e4e22826bf2b4126c.tar.gz
emacs-c4a0eff0112298de0a97b63e4e22826bf2b4126c.zip
Add seq-partition and seq-group-by
* lisp/emacs-lisp/seq.el: Better docstring for seq.el functions * test/automated/seq-tests.el: New tests for seq-partition and seq-group-by
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog5
-rw-r--r--test/automated/seq-tests.el16
2 files changed, 19 insertions, 2 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index 9ae9db3f8fb..f9a54b53420 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,6 +1,7 @@
12015-02-02 Nicolas Petton <nicolas@petton.fr> 12015-02-06 Nicolas Petton <nicolas@petton.fr>
2 2
3 * automated/seq-tests.el: New test for seq-mapcat. 3 * automated/seq-tests.el: New tests for seq-mapcat, seq-partition
4 and seq-group-by.
4 5
52015-02-05 Artur Malabarba <bruce.connor.am@gmail.com> 62015-02-05 Artur Malabarba <bruce.connor.am@gmail.com>
6 7
diff --git a/test/automated/seq-tests.el b/test/automated/seq-tests.el
index cc89c889675..ecbc0043210 100644
--- a/test/automated/seq-tests.el
+++ b/test/automated/seq-tests.el
@@ -205,5 +205,21 @@ Evaluate BODY for each created sequence.
205 (should (equal (seq-mapcat #'seq-reverse '((3 2 1) (6 5 4)) 'vector) 205 (should (equal (seq-mapcat #'seq-reverse '((3 2 1) (6 5 4)) 'vector)
206 '[1 2 3 4 5 6]))) 206 '[1 2 3 4 5 6])))
207 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
208(provide 'seq-tests) 224(provide 'seq-tests)
209;;; seq-tests.el ends here 225;;; seq-tests.el ends here