1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-06 20:00:46 -08:00

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.
This commit is contained in:
Stefan Kangas 2021-10-05 15:36:31 +02:00
parent 4bf532ee82
commit d652efcd08
6 changed files with 35 additions and 9 deletions

View file

@ -430,6 +430,23 @@
(buffer-hash))
(sha1 "foo"))))
(ert-deftest fns-tests-mapconcat ()
(should (string= (mapconcat #'identity '()) ""))
(should (string= (mapconcat #'identity '("a" "b")) "ab"))
(should (string= (mapconcat #'identity '() "_") ""))
(should (string= (mapconcat #'identity '("A") "_") "A"))
(should (string= (mapconcat #'identity '("A" "B") "_") "A_B"))
(should (string= (mapconcat #'identity '("A" "B" "C") "_") "A_B_C"))
;; non-ASCII strings
(should (string= (mapconcat #'identity '("Ä" "ø" "" "தமிழ்") "_漢字_")
"Ä_漢字_ø_漢字_☭_漢字_தமிழ்"))
;; vector
(should (string= (mapconcat #'identity ["a" "b"] "") "ab"))
;; bool-vector
(should (string= (mapconcat #'identity [nil nil] "") ""))
(should-error (mapconcat #'identity [nil nil t])
:type 'wrong-type-argument))
(ert-deftest fns-tests-mapcan ()
(should-error (mapcan))
(should-error (mapcan #'identity))