From 17d92f54124f3a0a64e8cd024eebc9ff2b40e4c7 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 9 Mar 2018 15:04:59 -0500 Subject: [PATCH] Quieten compilation of some test/lisp files * test/lisp/dired-tests.el (dired-test-bug27243-02) (dired-test-bug27243-03, dired-test-bug27899) (dired-test-with-temp-dirs): Remove unused local variables. * test/lisp/hi-lock-tests.el (hi-lock-bug26666) (hi-lock-test-set-pattern): Mark unused arguments. * test/lisp/ses-tests.el (ses-tests-renamed-cells-row-insertion): Remove unused global "ses-tests-trigger". * test/lisp/simple-tests.el (line-number-at-pos-when-passing-point): Remove unused local "pos". * test/lisp/emacs-lisp/benchmark-tests.el (benchmark-tests): Pacify compiler. * test/lisp/emacs-lisp/package-tests.el (package-test-signed): Replace obsolete function epg-configuration. * test/lisp/ls-lisp-tests.el: * test/lisp/eshell/em-ls-tests.el: Require dired. * test/lisp/progmodes/ruby-mode-tests.el (ruby-forward-sexp-skips-method-calls-with-keyword-names): * test/lisp/vc/diff-mode-tests.el (diff-mode-test-ignore-trailing-dashes): Replace interactive funcs. --- test/lisp/dired-tests.el | 23 +++++++++++------------ test/lisp/emacs-lisp/benchmark-tests.el | 14 ++++++++------ test/lisp/emacs-lisp/package-tests.el | 4 ++-- test/lisp/eshell/em-ls-tests.el | 1 + test/lisp/hi-lock-tests.el | 4 ++-- test/lisp/ls-lisp-tests.el | 1 + test/lisp/progmodes/ruby-mode-tests.el | 6 ++++-- test/lisp/ses-tests.el | 3 --- test/lisp/simple-tests.el | 13 ++++++------- test/lisp/vc/diff-mode-tests.el | 2 +- 10 files changed, 36 insertions(+), 35 deletions(-) diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index bb0e1bc3880..49ae4bc0400 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -210,12 +210,12 @@ (concat (file-name-as-directory test-dir) (file-name-as-directory "test-subdir")))) (push (dired-find-file) buffers) - (let ((pt2 (point))) ; Point is on test-file. - (switch-to-buffer buf) - ;; Sanity check: point should now be back on the subdirectory. - (should (eq (point) pt1)) - (push (dired test-dir) buffers) - (should (eq (point) pt1)))) + ;; Point is on test-file. + (switch-to-buffer buf) + ;; Sanity check: point should now be back on the subdirectory. + (should (eq (point) pt1)) + (push (dired test-dir) buffers) + (should (eq (point) pt1))) (dolist (buf buffers) (when (buffer-live-p buf) (kill-buffer buf))) (delete-directory test-dir t)))) @@ -224,7 +224,7 @@ "Test for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27243#61 ." (let ((test-dir (make-temp-file "test-dir-" t)) (dired-auto-revert-buffer t) - test-subdir1 test-subdir2 allbufs) + allbufs) (unwind-protect (progn (with-current-buffer (find-file-noselect test-dir) @@ -294,9 +294,9 @@ (ert-deftest dired-test-bug27899 () "Test for https://debbugs.gnu.org/27899 ." - (let* ((dir (expand-file-name "src" source-directory)) - (buf (dired (list dir "cygw32.c" "alloc.c" "w32xfns.c" "xdisp.c"))) - (orig dired-hide-details-mode)) + (dired (list (expand-file-name "src" source-directory) + "cygw32.c" "alloc.c" "w32xfns.c" "xdisp.c")) + (let ((orig dired-hide-details-mode)) (dired-goto-file (expand-file-name "cygw32.c")) (forward-line 0) (unwind-protect @@ -362,8 +362,7 @@ (defmacro dired-test-with-temp-dirs (just-empty-dirs &rest body) "Helper macro for Bug#27940 test." (declare (indent 1) (debug body)) - (let ((dir (make-symbol "dir")) - (ignore-funcs (make-symbol "ignore-funcs"))) + (let ((dir (make-symbol "dir"))) `(let* ((,dir (make-temp-file "bug27940" t)) (dired-deletion-confirmer (lambda (_) "yes")) ; Suppress prompts. (inhibit-message t) diff --git a/test/lisp/emacs-lisp/benchmark-tests.el b/test/lisp/emacs-lisp/benchmark-tests.el index 8de7818bdbf..cba53aefc9f 100644 --- a/test/lisp/emacs-lisp/benchmark-tests.el +++ b/test/lisp/emacs-lisp/benchmark-tests.el @@ -23,9 +23,9 @@ (require 'ert) (ert-deftest benchmark-tests () - (let (str t-long t-short) - (should (consp (benchmark-run nil (1+ 0)))) - (should (consp (benchmark-run 1 (1+ 0)))) + (let (str t-long t-short m) + (should (consp (benchmark-run nil (setq m (1+ 0))))) + (should (consp (benchmark-run 1 (setq m (1+ 0))))) (should (stringp (benchmark nil (1+ 0)))) (should (stringp (benchmark 1 (1+ 0)))) (should (consp (benchmark-run-compiled nil (1+ 0)))) @@ -33,10 +33,10 @@ ;; First test is heavier, must need longer time. (should (> (car (benchmark-run nil (let ((n 100000)) (while (> n 1) (setq n (1- n)))))) - (car (benchmark-run nil (1+ 0))))) + (car (benchmark-run nil (setq m (1+ 0)))))) (should (> (car (benchmark-run nil (let ((n 100000)) (while (> n 1) (setq n (1- n)))))) - (car (benchmark-run nil (1+ 0))))) + (car (benchmark-run nil (setq m (1+ 0)))))) (should (> (car (benchmark-run-compiled nil (let ((n 100000)) (while (> n 1) (setq n (1- n)))))) (car (benchmark-run-compiled nil (1+ 0))))) @@ -46,6 +46,8 @@ (setq str (benchmark nil '(1+ 0))) (string-match "Elapsed time: \\([0-9.]+\\)" str) (setq t-short (string-to-number (match-string 1 str))) - (should (> t-long t-short)))) + (should (> t-long t-short)) + ;; Silence compiler. + m)) ;;; benchmark-tests.el ends here. diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el index 83f52284889..0059c546ac2 100644 --- a/test/lisp/emacs-lisp/package-tests.el +++ b/test/lisp/emacs-lisp/package-tests.el @@ -473,8 +473,8 @@ Must called from within a `tar-mode' buffer." (let ((process-environment (cons (format "HOME=%s" homedir) process-environment))) - (epg-check-configuration (epg-configuration)) - (epg-find-configuration 'OpenPGP)) + (epg-check-configuration + (epg-find-configuration 'OpenPGP))) (delete-directory homedir t))))) (let* ((keyring (expand-file-name "key.pub" package-test-data-dir)) (package-test-data-dir diff --git a/test/lisp/eshell/em-ls-tests.el b/test/lisp/eshell/em-ls-tests.el index 1ce832f1dcc..c5c9eac3249 100644 --- a/test/lisp/eshell/em-ls-tests.el +++ b/test/lisp/eshell/em-ls-tests.el @@ -26,6 +26,7 @@ (require 'ert) (require 'em-ls) +(require 'dired) (ert-deftest em-ls-test-bug27631 () "Test for https://debbugs.gnu.org/27631 ." diff --git a/test/lisp/hi-lock-tests.el b/test/lisp/hi-lock-tests.el index 40d76ee9de5..4c639b03dca 100644 --- a/test/lisp/hi-lock-tests.el +++ b/test/lisp/hi-lock-tests.el @@ -29,7 +29,7 @@ (with-temp-buffer (insert "a A b B\n") (cl-letf (((symbol-function 'completing-read) - (lambda (prompt coll x y z hist defaults) + (lambda (_prompt _coll _x _y _z _hist defaults) (car defaults)))) (dotimes (_ 2) (let ((face (hi-lock-read-face-name))) @@ -41,7 +41,7 @@ (with-temp-buffer (insert "foo bar") (cl-letf (((symbol-function 'completing-read) - (lambda (prompt coll x y z hist defaults) + (lambda (_prompt _coll _x _y _z _hist defaults) (car defaults)))) (hi-lock-set-pattern "9999" (hi-lock-read-face-name)) ; No match (hi-lock-set-pattern "foo" (hi-lock-read-face-name))) diff --git a/test/lisp/ls-lisp-tests.el b/test/lisp/ls-lisp-tests.el index d16ffa3acdb..91e8b0b7011 100644 --- a/test/lisp/ls-lisp-tests.el +++ b/test/lisp/ls-lisp-tests.el @@ -26,6 +26,7 @@ ;;; Code: (require 'ert) (require 'ls-lisp) +(require 'dired) (ert-deftest ls-lisp-unload () "Test for https://debbugs.gnu.org/xxxxx ." diff --git a/test/lisp/progmodes/ruby-mode-tests.el b/test/lisp/progmodes/ruby-mode-tests.el index b16698fba11..72d83affaef 100644 --- a/test/lisp/progmodes/ruby-mode-tests.el +++ b/test/lisp/progmodes/ruby-mode-tests.el @@ -705,13 +705,15 @@ VALUES-PLIST is a list with alternating index and value elements." (ert-deftest ruby-forward-sexp-skips-method-calls-with-keyword-names () (ruby-with-temp-buffer ruby-sexp-test-example - (goto-line 2) + (goto-char (point-min)) + (forward-line 1) (ruby-forward-sexp) (should (= 8 (line-number-at-pos))))) (ert-deftest ruby-backward-sexp-skips-method-calls-with-keyword-names () (ruby-with-temp-buffer ruby-sexp-test-example - (goto-line 8) + (goto-char (point-min)) + (forward-line 7) (end-of-line) (ruby-backward-sexp) (should (= 2 (line-number-at-pos))))) diff --git a/test/lisp/ses-tests.el b/test/lisp/ses-tests.el index c9966e237fa..d08237e285b 100644 --- a/test/lisp/ses-tests.el +++ b/test/lisp/ses-tests.el @@ -147,13 +147,10 @@ to A2 and inserting a row, makes A2 value empty, and A3 equal to (should-not A2) (should (eq A3 2))))) -; (defvar ses-tests-trigger nil) - (ert-deftest ses-tests-renamed-cells-row-insertion () "Check that setting A1 to 1 and A2 to (1+ A1), and then renaming A1 to `foo' and A2 to `bar' jumping to `bar' and inserting a row, makes A2 value empty, and `bar' equal to 2." - (setq ses-tests-trigger nil) (let ((ses-initial-size '(2 . 1))) (with-temp-buffer (ses-mode) diff --git a/test/lisp/simple-tests.el b/test/lisp/simple-tests.el index 91fdd5e816e..64b341bd469 100644 --- a/test/lisp/simple-tests.el +++ b/test/lisp/simple-tests.el @@ -489,13 +489,12 @@ See Bug#21722." (should (equal pos (point)))))) (ert-deftest line-number-at-pos-when-passing-point () - (let (pos) - (with-temp-buffer - (insert "a\nb\nc\nd\n") - (should (equal (line-number-at-pos 1) 1)) - (should (equal (line-number-at-pos 3) 2)) - (should (equal (line-number-at-pos 5) 3)) - (should (equal (line-number-at-pos 7) 4))))) + (with-temp-buffer + (insert "a\nb\nc\nd\n") + (should (equal (line-number-at-pos 1) 1)) + (should (equal (line-number-at-pos 3) 2)) + (should (equal (line-number-at-pos 5) 3)) + (should (equal (line-number-at-pos 7) 4)))) ;;; Auto fill. diff --git a/test/lisp/vc/diff-mode-tests.el b/test/lisp/vc/diff-mode-tests.el index 1e35f9f7cd3..7900e41b257 100644 --- a/test/lisp/vc/diff-mode-tests.el +++ b/test/lisp/vc/diff-mode-tests.el @@ -182,7 +182,7 @@ youthfulness (with-temp-buffer (cd temp-dir) (insert patch) - (beginning-of-buffer) + (goto-char (point-min)) (diff-apply-hunk) (diff-apply-hunk) (diff-apply-hunk)) -- 2.39.2