summaryrefslogtreecommitdiff
path: root/test/src/fns-tests.el
diff options
context:
space:
mode:
authorMario Lang <mlang@delysid.org>2016-07-11 21:43:48 +0200
committerMario Lang <mlang@delysid.org>2016-07-11 21:43:48 +0200
commit846761e426ec4056b7d662adbe3ec4c80a7e8307 (patch)
tree694514486ff82022364e7b9edd948fb1923d012f /test/src/fns-tests.el
parent69b79bdff07bff2174d782dc4c69cf2dadc8225b (diff)
downloademacs-846761e426ec4056b7d662adbe3ec4c80a7e8307.tar.gz
emacs-846761e426ec4056b7d662adbe3ec4c80a7e8307.tar.bz2
emacs-846761e426ec4056b7d662adbe3ec4c80a7e8307.zip
Test mapcan
* test/src/fns-tests.el (fns-tests-mapcan): New test.
Diffstat (limited to 'test/src/fns-tests.el')
-rw-r--r--test/src/fns-tests.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index 848589692ea..c533bad3cdc 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -235,3 +235,13 @@
(backward-delete-char 1)
(buffer-hash))
(sha1 "foo"))))
+
+(ert-deftest fns-tests-mapcan ()
+ (should-error (mapcan))
+ (should-error (mapcan #'identity))
+ (should-error (mapcan #'identity (make-char-table 'foo)))
+ (should (equal (mapcan #'list '(1 2 3)) '(1 2 3)))
+ ;; `mapcan' is destructive
+ (let ((data '((foo) (bar))))
+ (should (equal (mapcan #'identity data) '(foo bar)))
+ (should (equal data '((foo bar) (bar))))))