From 112cb751419e4830a036ecabd6a799feb5977455 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 8 Sep 2022 16:08:42 -0400 Subject: [PATCH] test: Remove redundant "" arg to `mapconcat` * test/src/process-tests.el (process-test-stderr-filter): * test/src/print-tests.el (print-tests-continuous-numbering): * test/src/fns-tests.el (fns-tests-mapconcat): * test/src/data-tests.el (test-bool-vector-to-hex-string): * test/src/casefiddle-tests.el (casefiddle-tests-char-properties) (casefiddle-tests-case-table, casefiddle-tests-casing-character): * test/lisp/tabify-tests.el (tabify-tests--test-changes): * test/lisp/subr-tests.el (subr-tests-bug22027): * test/lisp/sort-tests.el (sort-tests-random-word): * test/lisp/net/hmac-md5-tests.el (hmac-md5-test-encode-string): * test/lisp/md4-tests.el (md4-tests-digest->hex): * test/lisp/emacs-lisp/cl-extra-tests.el (cl-extra-test-map): * test/lisp/dired-tests.el (dired-test-directory-files): * test/lisp/char-fold-tests.el (char-fold--random-word): * test/lisp/ansi-color-tests.el (ansi-color-incomplete-sequences-test): Remove redundant "" arg to `mapconcat`. --- test/lisp/ansi-color-tests.el | 4 ++-- test/lisp/char-fold-tests.el | 2 +- test/lisp/dired-tests.el | 4 ++-- test/lisp/emacs-lisp/cl-extra-tests.el | 2 +- test/lisp/md4-tests.el | 2 +- test/lisp/net/hmac-md5-tests.el | 2 +- test/lisp/sort-tests.el | 2 +- test/lisp/subr-tests.el | 2 +- test/lisp/tabify-tests.el | 4 ++-- test/src/casefiddle-tests.el | 6 +++--- test/src/data-tests.el | 3 +-- test/src/fns-tests.el | 4 ++-- test/src/print-tests.el | 6 ++++-- test/src/process-tests.el | 4 ++-- 14 files changed, 24 insertions(+), 23 deletions(-) diff --git a/test/lisp/ansi-color-tests.el b/test/lisp/ansi-color-tests.el index 1b04e8e9def..f672f334914 100644 --- a/test/lisp/ansi-color-tests.el +++ b/test/lisp/ansi-color-tests.el @@ -135,7 +135,7 @@ strings with `eq', this function compares them with `equal'." (with-temp-buffer (should (equal-including-properties filtered-str - (mapconcat ansi-filt strs "")))) + (mapconcat ansi-filt strs)))) ;; Tests for `ansi-color-filter-region' (with-temp-buffer @@ -156,7 +156,7 @@ strings with `eq', this function compares them with `equal'." (with-temp-buffer (should (ansi-color-tests-equal-props propertized-str - (mapconcat ansi-app strs "")))) + (mapconcat ansi-app strs)))) ;; Tests for `ansi-color-apply-on-region' (with-temp-buffer diff --git a/test/lisp/char-fold-tests.el b/test/lisp/char-fold-tests.el index 749ec0a8d3e..e7f5ff6fd2f 100644 --- a/test/lisp/char-fold-tests.el +++ b/test/lisp/char-fold-tests.el @@ -26,7 +26,7 @@ (defun char-fold--random-word (n) (mapconcat (lambda (_) (string (+ 9 (random 117)))) - (make-list n nil) "")) + (make-list n nil))) (defun char-fold--ascii-upcase (string) "Like `upcase' but acts on ASCII characters only." diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index 9cf01519052..09becc7fe7a 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -456,8 +456,8 @@ (dolist (file '(a b c d)) (make-empty-file (expand-file-name (symbol-name file) testdir))) (should (= 6 (length (directory-files testdir)))) - (should (equal "abcd" (mapconcat 'identity (directory-files - testdir nil nod) ""))) + (should (equal "abcd" (mapconcat #'identity (directory-files + testdir nil nod)))) (should (= 2 (length (directory-files testdir nil "[bc]")))) (should (= 3 (length (directory-files testdir nil nod nil 3)))) (dolist (file '(5 4 3 2 1)) diff --git a/test/lisp/emacs-lisp/cl-extra-tests.el b/test/lisp/emacs-lisp/cl-extra-tests.el index 801885c0d40..297e413d858 100644 --- a/test/lisp/emacs-lisp/cl-extra-tests.el +++ b/test/lisp/emacs-lisp/cl-extra-tests.el @@ -77,7 +77,7 @@ (fn3 (lambda (x _y _z) (string-to-char (format "%S" x))))) (should (equal lst (cl-map 'list fn1 lst))) (should (equal (vconcat lst2) (cl-map 'vector fn2 lst lst2))) - (should (equal (mapconcat (lambda (x) (format "%S" x)) lst "") + (should (equal (mapconcat (lambda (x) (format "%S" x)) lst) (cl-map 'string fn3 lst lst2 lst3))))) (ert-deftest cl-extra-test-maplist () diff --git a/test/lisp/md4-tests.el b/test/lisp/md4-tests.el index fb7df652bc6..d1f227cb90a 100644 --- a/test/lisp/md4-tests.el +++ b/test/lisp/md4-tests.el @@ -29,7 +29,7 @@ (defun md4-tests-digest->hex (str) "Print digest STR in hexadecimal." - (mapconcat (lambda (x) (format "%02x" x)) str "")) + (mapconcat (lambda (x) (format "%02x" x)) str)) (ert-deftest md4-test-rfc1320 () "Verify the test suite results in RFC 1320. diff --git a/test/lisp/net/hmac-md5-tests.el b/test/lisp/net/hmac-md5-tests.el index ce08dd89d10..09bbb8015e9 100644 --- a/test/lisp/net/hmac-md5-tests.el +++ b/test/lisp/net/hmac-md5-tests.el @@ -48,7 +48,7 @@ (should (equal (encode-hex-string (hmac-md5 (decode-hex-string (mapconcat (lambda (c) (concat (list c) "d")) - (make-string 50 ?c) "")) + (make-string 50 ?c))) (decode-hex-string "0102030405060708090a0b0c0d0e0f10111213141516171819"))) "697eaf0aca3a3aea3a75164746ffaa79")) diff --git a/test/lisp/sort-tests.el b/test/lisp/sort-tests.el index 7f49cc38d1b..d8d42452ec8 100644 --- a/test/lisp/sort-tests.el +++ b/test/lisp/sort-tests.el @@ -28,7 +28,7 @@ (mapconcat (lambda (_) (string (let ((c (random 52))) (+ (if (> c 25) 71 65) c)))) - (make-list n nil) "")) + (make-list n nil))) (defun sort-tests--insert-words-sort-and-compare (words separator function reverse less-predicate) (with-temp-buffer diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 3d03057f567..4310b7291ad 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -635,7 +635,7 @@ cf. Bug#25477." (let ((default "foo") res) (cl-letf (((symbol-function 'read-string) (lambda (_prompt &optional _init _hist def _inher-input) def))) - (setq res (read-passwd "pass: " 'confirm (mapconcat #'string default ""))) + (setq res (read-passwd "pass: " 'confirm (mapconcat #'string default))) (should (string= default res))))) (ert-deftest subr-tests--gensym () diff --git a/test/lisp/tabify-tests.el b/test/lisp/tabify-tests.el index eaa3527df07..1c8940c30fe 100644 --- a/test/lisp/tabify-tests.el +++ b/test/lisp/tabify-tests.el @@ -27,9 +27,9 @@ (defun tabify-tests--test-changes (fun changes width) (with-temp-buffer (let ((tab-width width)) - (insert (mapconcat #'car changes "")) + (insert (mapconcat #'car changes)) (funcall fun (point-min) (point-max)) - (should (equal (buffer-string) (mapconcat #'cadr changes "")))))) + (should (equal (buffer-string) (mapconcat #'cadr changes)))))) (ert-deftest tabify-tests-untabify () (let ((changes '(("***\n" "***\n") diff --git a/test/src/casefiddle-tests.el b/test/src/casefiddle-tests.el index eb096f21129..652af417293 100644 --- a/test/src/casefiddle-tests.el +++ b/test/src/casefiddle-tests.el @@ -57,7 +57,7 @@ errors))) (setq expected (cdr expected))))) (when errors - (ert-fail (mapconcat (lambda (line) line) (nreverse errors) ""))))) + (ert-fail (mapconcat #'identity (nreverse errors)))))) (defconst casefiddle-tests--characters @@ -98,7 +98,7 @@ errors))) (setq props (cdr props) tabs (cdr tabs) expected (cdr expected))))) (when errors - (mapconcat (lambda (line) line) (nreverse errors) ""))))) + (mapconcat #'identity (nreverse errors)))))) (ert-deftest casefiddle-tests-casing-character () @@ -116,7 +116,7 @@ errors))) (setq funcs (cdr funcs) expected (cdr expected))))) (when errors - (mapconcat (lambda (line) line) (nreverse errors) ""))))) + (mapconcat (lambda (line) line) (nreverse errors)))))) (ert-deftest casefiddle-tests-casing-word () diff --git a/test/src/data-tests.el b/test/src/data-tests.el index 0f84b2fb776..463a894d095 100644 --- a/test/src/data-tests.el +++ b/test/src/data-tests.el @@ -200,8 +200,7 @@ this is exactly representable and is greater than nibbles) (setf v (nthcdr 4 v))) (mapconcat (lambda (n) (format "%X" n)) - (nreverse nibbles) - ""))) + (nreverse nibbles)))) (defun test-bool-vector-count-consecutive-tc (desc) "Run a test case for `bool-vector-count-consecutive'. diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index 4ef428af03e..fe8df7097a7 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el @@ -614,9 +614,9 @@ (should (string= (mapconcat #'identity '("Ä" "ø" "☭" "தமிழ்") "_漢字_") "Ä_漢字_ø_漢字_☭_漢字_தமிழ்")) ;; vector - (should (string= (mapconcat #'identity ["a" "b"] "") "ab")) + (should (string= (mapconcat #'identity ["a" "b"]) "ab")) ;; bool-vector - (should (string= (mapconcat #'identity [nil nil] "") "")) + (should (string= (mapconcat #'identity [nil nil]) "")) (should-error (mapconcat #'identity [nil nil t]) :type 'wrong-type-argument)) diff --git a/test/src/print-tests.el b/test/src/print-tests.el index 5c349342eb3..faab196f22f 100644 --- a/test/src/print-tests.el +++ b/test/src/print-tests.el @@ -190,7 +190,8 @@ otherwise, use a different charset." "Printing observes `print-continuous-numbering'." ;; cl-print does not support print-continuous-numbering. :expected-result (if (eq (symbol-function #'print-tests--prin1-to-string) - #'cl-prin1-to-string) :failed :passed) + #'cl-prin1-to-string) + :failed :passed) (let* ((x (list 1)) (y "hello") (g (gensym)) @@ -201,7 +202,8 @@ otherwise, use a different charset." (print-number-table nil)) (should (string-match "(#1=(1) #1# #2=\"hello\" #2#)(#3=#:g[[:digit:]]+ #3#)(#1# #2# #3#)#2#$" - (mapconcat #'print-tests--prin1-to-string `((,x ,x ,y ,y) (,g ,g) (,x ,y ,g) ,y) "")))) + (mapconcat #'print-tests--prin1-to-string + `((,x ,x ,y ,y) (,g ,g) (,x ,y ,g) ,y))))) ;; This is the special case for byte-compile-output-docform ;; mentioned in a comment in print_preprocess. When diff --git a/test/src/process-tests.el b/test/src/process-tests.el index 6e1e148332c..7d3d9eb72b8 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el @@ -134,12 +134,12 @@ process to complete." (should (equal 1 (with-current-buffer stdout-buffer (point-max)))) (should (equal "hello stdout!\n" - (mapconcat #'identity (nreverse stdout-output) ""))) + (mapconcat #'identity (nreverse stdout-output)))) (should stderr-sentinel-called) (should (equal 1 (with-current-buffer stderr-buffer (point-max)))) (should (equal "hello stderr!\n" - (mapconcat #'identity (nreverse stderr-output) "")))))) + (mapconcat #'identity (nreverse stderr-output))))))) (ert-deftest set-process-filter-t () "Test setting process filter to t and back." ;; Bug#36591 -- 2.39.2