From: Basil L. Contovounesios Date: Tue, 2 Jun 2020 22:14:23 +0000 (+0100) Subject: Silence some byte-compiler warnings in tests X-Git-Tag: emacs-27.1-rc1~86 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7d323f07c0b540547c4aab38069972a918eff9d3;p=emacs.git Silence some byte-compiler warnings in tests * test/lisp/emacs-lisp/cl-generic-tests.el: * test/lisp/progmodes/elisp-mode-tests.el: Declare functions referred to within macroexpansions. (xref-elisp-overloadable-no-default) (xref-elisp-overloadable-co-located-default) (xref-elisp-overloadable-separate-default): Prefix unused arguments with underscore. * test/lisp/international/ccl-tests.el: * test/lisp/wdired-tests.el: * test/lisp/emacs-lisp/package-tests.el: Declare functions used. (package-test-update-archives, package-test-signed): Use revert-buffer in place of its obsolete alias package-menu-refresh. * test/lisp/eshell/eshell-tests.el: * test/lisp/mail/footnote-tests.el: * test/src/buffer-tests.el: Require dependencies used. * test/lisp/image/exif-tests.el: Remove unneeded (require 'seq). (test-exit-direct-ascii-value): Actually perform the test. * test/lisp/progmodes/sql-tests.el (sql-test-add-existing-product): Fix typo. * test/lisp/simple-tests.el (with-shell-command-dont-erase-buffer): * test/src/data-tests.el (test-bool-vector-bv-from-hex-string) (test-bool-vector-apply-mock-op): Remove unused local variables. --- diff --git a/test/lisp/emacs-lisp/cl-generic-tests.el b/test/lisp/emacs-lisp/cl-generic-tests.el index d9f1cb9ec43..51c9884ddc8 100644 --- a/test/lisp/emacs-lisp/cl-generic-tests.el +++ b/test/lisp/emacs-lisp/cl-generic-tests.el @@ -23,9 +23,15 @@ ;;; Code: -(eval-when-compile (require 'ert)) ;Don't indirectly require cl-lib at run-time. (require 'cl-generic) +;; Don't indirectly require `cl-lib' at run-time. +(eval-when-compile (require 'ert)) +(declare-function ert--should-signal-hook "ert") +(declare-function ert--signal-should-execution "ert") +(declare-function ert-fail "ert") +(declare-function ert-set-test "ert") + (fmakunbound 'cl--generic-1) (cl-defgeneric cl--generic-1 (x y)) (cl-defgeneric (setf cl--generic-1) (v y z) "My generic doc.") diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el index 7d354d6ecde..4fcaf0e84c2 100644 --- a/test/lisp/emacs-lisp/package-tests.el +++ b/test/lisp/emacs-lisp/package-tests.el @@ -267,6 +267,9 @@ Must called from within a `tar-mode' buffer." (should (package-installed-p 'simple-single)) (should (package-installed-p 'simple-depend)))) +(declare-function macro-problem-func "macro-problem" ()) +(declare-function macro-problem-10-and-90 "macro-problem" ()) + (ert-deftest package-test-macro-compilation () "Install a package which includes a dependency." (with-package-test (:basedir "package-resources") @@ -391,7 +394,7 @@ Must called from within a `tar-mode' buffer." "Test updating package archives." (with-package-test () (let ((buf (package-list-packages))) - (package-menu-refresh) + (revert-buffer) (search-forward-regexp "^ +simple-single") (package-menu-mark-install) (package-menu-execute) @@ -399,7 +402,7 @@ Must called from within a `tar-mode' buffer." (let ((package-test-data-dir (expand-file-name "package-resources/newer-versions" package-test-file-dir))) (setq package-archives `(("gnu" . ,package-test-data-dir))) - (package-menu-refresh) + (revert-buffer) ;; New version should be available and old version should be installed (goto-char (point-min)) @@ -411,7 +414,7 @@ Must called from within a `tar-mode' buffer." (package-menu-mark-upgrades) (package-menu-execute) - (package-menu-refresh) + (revert-buffer) (should (package-installed-p 'simple-single '(1 4))))))) (ert-deftest package-test-update-archives-async () @@ -541,6 +544,8 @@ Must called from within a `tar-mode' buffer." (let ((process-environment (cons (concat "HOME=" homedir) process-environment))) + (require 'epg-config) + (defvar epg-config--program-alist) (epg-find-configuration 'OpenPGP nil ;; By default we require gpg2 2.1+ due to some @@ -573,7 +578,7 @@ Must called from within a `tar-mode' buffer." (should (progn (package-install 'signed-bad) 'noerror))) ;; Check if the installed package status is updated. (let ((buf (package-list-packages))) - (package-menu-refresh) + (revert-buffer) (should (re-search-forward "^\\s-+signed-good\\s-+\\(\\S-+\\)\\s-+\\(\\S-+\\)\\s-" nil t)) diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el index 026818ab067..70694309443 100644 --- a/test/lisp/eshell/eshell-tests.el +++ b/test/lisp/eshell/eshell-tests.el @@ -26,6 +26,7 @@ ;;; Code: (require 'ert) +(require 'esh-mode) (require 'eshell) (defmacro with-temp-eshell (&rest body) diff --git a/test/lisp/image/exif-tests.el b/test/lisp/image/exif-tests.el index 8a2231106f0..9e5da46b508 100644 --- a/test/lisp/image/exif-tests.el +++ b/test/lisp/image/exif-tests.el @@ -21,7 +21,6 @@ (require 'ert) (require 'exif) -(require 'seq) (defun test-image-file (name) (expand-file-name @@ -49,7 +48,7 @@ (should (equal (exif-elem exif 'artist) "z")))) (ert-deftest test-exit-direct-ascii-value () - (equal (exif--direct-ascii-value 28005 2 t) (string ?e ?m 0)) - (equal (exif--direct-ascii-value 28005 2 nil) (string ?m ?e 0))) + (should (equal (exif--direct-ascii-value 28005 2 t) (string ?e ?m 0))) + (should (equal (exif--direct-ascii-value 28005 2 nil) (string ?m ?e 0)))) ;;; exif-tests.el ends here diff --git a/test/lisp/international/ccl-tests.el b/test/lisp/international/ccl-tests.el index 3581cd784f0..c8a5512d6f0 100644 --- a/test/lisp/international/ccl-tests.el +++ b/test/lisp/international/ccl-tests.el @@ -94,6 +94,9 @@ At EOF: (ccl-dump prog-pgg-code) (should (equal (buffer-string) prog-pgg-dump)))) +(defvar pgg-parse-crc24) +(declare-function pgg-parse-crc24-string "pgg-parse" (string)) + (ert-deftest pgg-parse-crc24 () ;; Compiler (require 'pgg) diff --git a/test/lisp/mail/footnote-tests.el b/test/lisp/mail/footnote-tests.el index 458964c306e..79f48072391 100644 --- a/test/lisp/mail/footnote-tests.el +++ b/test/lisp/mail/footnote-tests.el @@ -18,12 +18,10 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . -;;; Commentary: - -;; - ;;; Code: +(require 'footnote) + (ert-deftest footnote-tests-same-place () (with-temp-buffer (footnote-mode 1) diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index b793f7389b4..2ba00656862 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -598,16 +598,17 @@ to (xref-elisp-test-descr-to-target xref)." ;; Define some mode-local overloadable/overridden functions for xref to find (require 'mode-local) +(declare-function xref-elisp-overloadable-no-methods-default "elisp-mode-tests") +(declare-function xref-elisp-overloadable-no-default-default "elisp-mode-tests") + (define-overloadable-function xref-elisp-overloadable-no-methods () "doc string overloadable no-methods") (define-overloadable-function xref-elisp-overloadable-no-default () "doc string overloadable no-default") -;; FIXME: byte compiler complains about unused lexical arguments -;; generated by this macro. (define-mode-local-override xref-elisp-overloadable-no-default c-mode - (start end &optional nonterminal depth returnonerror) + (_start _end &optional _nonterminal _depth _returnonerror) "doc string overloadable no-default c-mode." "result overloadable no-default c-mode.") @@ -616,7 +617,7 @@ to (xref-elisp-test-descr-to-target xref)." "result overloadable co-located-default.") (define-mode-local-override xref-elisp-overloadable-co-located-default c-mode - (start end &optional nonterminal depth returnonerror) + (_start _end &optional _nonterminal _depth _returnonerror) "doc string overloadable co-located-default c-mode." "result overloadable co-located-default c-mode.") @@ -628,7 +629,7 @@ to (xref-elisp-test-descr-to-target xref)." "result overloadable separate-default.") (define-mode-local-override xref-elisp-overloadable-separate-default c-mode - (start end &optional nonterminal depth returnonerror) + (_start _end &optional _nonterminal _depth _returnonerror) "doc string overloadable separate-default c-mode." "result overloadable separate-default c-mode.") diff --git a/test/lisp/progmodes/sql-tests.el b/test/lisp/progmodes/sql-tests.el index d6f89341bed..65ed76bfb5d 100644 --- a/test/lisp/progmodes/sql-tests.el +++ b/test/lisp/progmodes/sql-tests.el @@ -193,7 +193,7 @@ Perform ACTION and validate results" "Add a product that already exists." (sql-test-product-feature-harness - (should-error (sql-add-feature 'a "Aaa")) + (should-error (sql-add-product 'a "Aaa")) (should (equal (pp-to-string (assoc 'a sql-product-alist)) "(a :X 1 :Y 2 :Z sql-test-feature-value-a)\n")))) diff --git a/test/lisp/simple-tests.el b/test/lisp/simple-tests.el index 03f7260f551..c8b913b3f1c 100644 --- a/test/lisp/simple-tests.el +++ b/test/lisp/simple-tests.el @@ -716,8 +716,7 @@ See Bug#21722." (defmacro with-shell-command-dont-erase-buffer (str output-buffer-is-current &rest body) (declare (debug (sexp form body)) (indent 2)) - (let ((expected (make-symbol "expected")) - (command (make-symbol "command")) + (let ((command (make-symbol "command")) (caller-buf (make-symbol "caller-buf")) (output-buf (make-symbol "output-buf"))) `(let* ((,caller-buf (generate-new-buffer "caller-buf")) diff --git a/test/lisp/wdired-tests.el b/test/lisp/wdired-tests.el index baa547758ef..5b01c54cf24 100644 --- a/test/lisp/wdired-tests.el +++ b/test/lisp/wdired-tests.el @@ -129,6 +129,8 @@ wdired-mode." (delete-directory test-dir t))))) (defvar server-socket-dir) +(declare-function dired-smart-shell-command "dired-x" + (command &optional output-buffer error-buffer)) (ert-deftest wdired-test-bug34915 () "Test editing when dired-listing-switches includes -F. diff --git a/test/src/buffer-tests.el b/test/src/buffer-tests.el index 1c356698f66..60d29dd3a12 100644 --- a/test/src/buffer-tests.el +++ b/test/src/buffer-tests.el @@ -20,6 +20,7 @@ ;;; Code: (require 'ert) +(require 'seq) (eval-when-compile (require 'cl-lib)) (ert-deftest overlay-modification-hooks-message-other-buf () diff --git a/test/src/data-tests.el b/test/src/data-tests.el index 3cebb3dfa57..ed092039078 100644 --- a/test/src/data-tests.el +++ b/test/src/data-tests.el @@ -174,7 +174,7 @@ most-positive-fixnum, which is just less than a power of 2.") sum 1)) (defun test-bool-vector-bv-from-hex-string (desc) - (let (bv nchars nibbles) + (let (bv nibbles) (dolist (c (string-to-list desc)) (push (string-to-number (char-to-string c) @@ -244,9 +244,9 @@ comparing the subr with a much slower lisp implementation." (defun test-bool-vector-apply-mock-op (mock a b c) "Compute (slowly) the correct result of a bool-vector set operation." - (let (changed nv) + (let (changed) (cl-assert (eql (length b) (length c))) - (if a (setf nv a) + (unless a (setf a (make-bool-vector (length b) nil)) (setf changed t))