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.
This commit is contained in:
Glenn Morris 2018-03-09 15:04:59 -05:00
parent 80e145fc96
commit 94a59a6d83
10 changed files with 36 additions and 35 deletions

View file

@ -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)

View file

@ -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.

View file

@ -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

View file

@ -26,6 +26,7 @@
(require 'ert)
(require 'em-ls)
(require 'dired)
(ert-deftest em-ls-test-bug27631 ()
"Test for https://debbugs.gnu.org/27631 ."

View file

@ -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)))

View file

@ -26,6 +26,7 @@
;;; Code:
(require 'ert)
(require 'ls-lisp)
(require 'dired)
(ert-deftest ls-lisp-unload ()
"Test for https://debbugs.gnu.org/xxxxx ."

View file

@ -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)))))

View file

@ -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)

View file

@ -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.

View file

@ -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))