aboutsummaryrefslogtreecommitdiffstats
path: root/test/src/fns-tests.el
diff options
context:
space:
mode:
authorStefan Kangas2021-10-05 15:36:31 +0200
committerStefan Kangas2021-10-05 15:38:38 +0200
commitd652efcd087099c71cd76c4bbf2bbf04314844b4 (patch)
tree828ea43e01d213d00ec2832d7c877d246f9328e6 /test/src/fns-tests.el
parent4bf532ee82473740cfd43c66ecbfe6cfddf99df9 (diff)
downloademacs-d652efcd087099c71cd76c4bbf2bbf04314844b4.tar.gz
emacs-d652efcd087099c71cd76c4bbf2bbf04314844b4.zip
Make 'mapconcat' argument 'separator' optional
* src/fns.c (Fmapconcat): Make third 'separator' argument optional. (Bug#50965) * doc/lispref/functions.texi (Mapping Functions): Update documentation for above change. * test/src/fns-tests.el (fns-tests-mapconcat): New test. * doc/misc/cl.texi (Obsolete Setf Customization): Don't use third mapconcat argument in example. * lisp/emacs-lisp/subr-x.el (string-join): Doc fix.
Diffstat (limited to 'test/src/fns-tests.el')
-rw-r--r--test/src/fns-tests.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index 57594572094..2d641cc3111 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -430,6 +430,23 @@
430 (buffer-hash)) 430 (buffer-hash))
431 (sha1 "foo")))) 431 (sha1 "foo"))))
432 432
433(ert-deftest fns-tests-mapconcat ()
434 (should (string= (mapconcat #'identity '()) ""))
435 (should (string= (mapconcat #'identity '("a" "b")) "ab"))
436 (should (string= (mapconcat #'identity '() "_") ""))
437 (should (string= (mapconcat #'identity '("A") "_") "A"))
438 (should (string= (mapconcat #'identity '("A" "B") "_") "A_B"))
439 (should (string= (mapconcat #'identity '("A" "B" "C") "_") "A_B_C"))
440 ;; non-ASCII strings
441 (should (string= (mapconcat #'identity '("Ä" "ø" "☭" "தமிழ்") "_漢字_")
442 "Ä_漢字_ø_漢字_☭_漢字_தமிழ்"))
443 ;; vector
444 (should (string= (mapconcat #'identity ["a" "b"] "") "ab"))
445 ;; bool-vector
446 (should (string= (mapconcat #'identity [nil nil] "") ""))
447 (should-error (mapconcat #'identity [nil nil t])
448 :type 'wrong-type-argument))
449
433(ert-deftest fns-tests-mapcan () 450(ert-deftest fns-tests-mapcan ()
434 (should-error (mapcan)) 451 (should-error (mapcan))
435 (should-error (mapcan #'identity)) 452 (should-error (mapcan #'identity))