]> code.delx.au - gnu-emacs/commitdiff
Test mapcan
authorMario Lang <mlang@delysid.org>
Mon, 11 Jul 2016 19:43:48 +0000 (21:43 +0200)
committerMario Lang <mlang@delysid.org>
Mon, 11 Jul 2016 19:43:48 +0000 (21:43 +0200)
* test/src/fns-tests.el (fns-tests-mapcan): New test.

test/src/fns-tests.el

index 848589692ea25a2bc77dd59a2428e8a29d5fd446..c533bad3cdcea5d03decf5dd819812a32ff41f17 100644 (file)
                    (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))))))