aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNicolas Petton2015-02-11 09:21:03 +0100
committerNicolas Petton2015-02-11 14:48:18 +0100
commit4fb5565d0a0cd9640a242028c92b8b4e2bd4683e (patch)
tree67f5e8b5595d3b92d3a1f3c2b6b8a26d107d7501 /test
parentc49e769d8f141b0307db19ed2a5fa80e0696b1dc (diff)
downloademacs-4fb5565d0a0cd9640a242028c92b8b4e2bd4683e.tar.gz
emacs-4fb5565d0a0cd9640a242028c92b8b4e2bd4683e.zip
Add a backward-compatible version of seq-reverse
* lisp/emacs-lisp/seq.el (seq-reverse): Add a backward-compatible version of seq-reverse that works on sequences in Emacs 24. Bump version to 1.2. * test/automated/seq-tests.el (test-seq-reverse, test-seq-group-by): Add a test for seq-reverse and update test for seq-group-by to test vectors and strings, not only lists.
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog6
-rw-r--r--test/automated/seq-tests.el11
2 files changed, 15 insertions, 2 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index b080961f681..979214c45da 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,9 @@
12015-02-11 Nicolas Petton <nicolas@petton.fr>
2
3 * automated/seq-tests.el (test-seq-reverse, test-seq-group-by):
4 Add a test for seq-reverse and update test for seq-group-by to
5 test vectors and strings, not only lists.
6
12015-02-10 Glenn Morris <rgm@gnu.org> 72015-02-10 Glenn Morris <rgm@gnu.org>
2 8
3 * automated/package-test.el (package-test-signed): 9 * automated/package-test.el (package-test-signed):
diff --git a/test/automated/seq-tests.el b/test/automated/seq-tests.el
index b92a15cacc5..badb3267f43 100644
--- a/test/automated/seq-tests.el
+++ b/test/automated/seq-tests.el
@@ -216,10 +216,17 @@ Evaluate BODY for each created sequence.
216 (should (equal (seq-partition '(1 2 3) -1) '()))) 216 (should (equal (seq-partition '(1 2 3) -1) '())))
217 217
218(ert-deftest test-seq-group-by () 218(ert-deftest test-seq-group-by ()
219 (should (equal (seq-group-by #'test-sequences-oddp '(1 2 3 4)) 219 (with-test-sequences (seq '(1 2 3 4))
220 '((t 1 3) (nil 2 4)))) 220 (should (equal (seq-group-by #'test-sequences-oddp seq)
221 '((t 1 3) (nil 2 4)))))
221 (should (equal (seq-group-by #'car '((a 1) (b 3) (c 4) (a 2))) 222 (should (equal (seq-group-by #'car '((a 1) (b 3) (c 4) (a 2)))
222 '((b (b 3)) (c (c 4)) (a (a 1) (a 2)))))) 223 '((b (b 3)) (c (c 4)) (a (a 1) (a 2))))))
223 224
225(ert-deftest test-seq-reverse ()
226 (with-test-sequences (seq '(1 2 3 4))
227 (should (same-contents-p (seq-reverse seq) '(4 3 2 1)))
228 (should (equal (type-of (seq-reverse seq))
229 (type-of seq)))))
230
224(provide 'seq-tests) 231(provide 'seq-tests)
225;;; seq-tests.el ends here 232;;; seq-tests.el ends here