summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBasil L. Contovounesios <contovob@tcd.ie>2020-06-21 12:50:34 +0100
committerBasil L. Contovounesios <contovob@tcd.ie>2020-06-21 12:50:34 +0100
commit4cc6854cd4b0857e223ed6bc1b1b1a051dd83480 (patch)
tree4809d5c25c6be4ebfb78099b30d26f564bf1e7b5 /test
parenta1b487eac0ec10059eb2b8c5e7efc9eec1342148 (diff)
downloademacs-4cc6854cd4b0857e223ed6bc1b1b1a051dd83480.tar.gz
Silence some warnings in tests
* test/lisp/emacs-lisp/package-tests.el (package-test-suffix-matches): Evaluate lambda. (package-test-list-filter-marked): * test/lisp/vc/vc-tests.el (vc-test--run-maybe-unsupported-function): * test/src/undo-tests.el (undo-test-skip-invalidated-markers): Silence "unused local variable" warnings. * test/lisp/imenu-tests.el (imenu-simple-scan-deftest): Fix docstring. Don't shadow global major-mode.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/emacs-lisp/package-tests.el24
-rw-r--r--test/lisp/imenu-tests.el15
-rw-r--r--test/lisp/vc/vc-tests.el9
-rw-r--r--test/src/undo-tests.el2
4 files changed, 24 insertions, 26 deletions
diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el
index 90714af3061..fecabba40f5 100644
--- a/test/lisp/emacs-lisp/package-tests.el
+++ b/test/lisp/emacs-lisp/package-tests.el
@@ -176,7 +176,7 @@
(defun package-test-suffix-matches (base suffix-list)
"Return file names matching BASE concatenated with each item in SUFFIX-LIST"
(cl-mapcan
- '(lambda (item) (file-expand-wildcards (concat base item)))
+ (lambda (item) (file-expand-wildcards (concat base item)))
suffix-list))
(defvar tar-parse-info)
@@ -419,17 +419,17 @@ Must called from within a `tar-mode' buffer."
(ert-deftest package-test-list-filter-marked ()
"Ensure package list is filtered correctly by non-empty mark."
(with-package-test ()
- (let ((buf (package-list-packages)))
- (revert-buffer)
- (search-forward-regexp "^ +simple-single")
- (package-menu-mark-install)
- (package-menu-filter-marked)
- (goto-char (point-min))
- (should (re-search-forward "^I +simple-single" nil t))
- (should (= (count-lines (point-min) (point-max)) 1))
- (package-menu-mark-unmark)
- ;; No marked packages in default environment.
- (should-error (package-menu-filter-marked)))))
+ (package-list-packages)
+ (revert-buffer)
+ (search-forward-regexp "^ +simple-single")
+ (package-menu-mark-install)
+ (package-menu-filter-marked)
+ (goto-char (point-min))
+ (should (re-search-forward "^I +simple-single" nil t))
+ (should (= (count-lines (point-min) (point-max)) 1))
+ (package-menu-mark-unmark)
+ ;; No marked packages in default environment.
+ (should-error (package-menu-filter-marked))))
(ert-deftest package-test-list-filter-by-version ()
(with-package-menu-test
diff --git a/test/lisp/imenu-tests.el b/test/lisp/imenu-tests.el
index 5dbeb882e01..e5cdb9e65d1 100644
--- a/test/lisp/imenu-tests.el
+++ b/test/lisp/imenu-tests.el
@@ -50,24 +50,23 @@
(setq input (cdr input)))))
result))
-(defmacro imenu-simple-scan-deftest (name doc major-mode content expected-items)
+(defmacro imenu-simple-scan-deftest (name doc mode content expected-items)
"Generate an ert test for mode-own imenu expression.
Run `imenu-create-index-function' at the buffer which content is
-CONTENT with MAJOR-MODE. A generated test runs `imenu-create-index-function'
-at the buffer which content is CONTENT with MAJOR-MODE. Then it compares a list
-of strings which are picked up from the result with EXPECTED-ITEMS."
+CONTENT with major MODE. A generated test runs `imenu-create-index-function'
+at the buffer which content is CONTENT with major MODE. Then it compares a
+list of strings which are picked up from the result with EXPECTED-ITEMS."
(let ((xname (intern (concat "imenu-simple-scan-deftest-" (symbol-name name)))))
`(ert-deftest ,xname ()
- ,doc
+ ,doc
(with-temp-buffer
(insert ,content)
- (funcall ',major-mode)
+ (funcall #',mode)
(let ((result-items (sort (imenu-simple-scan-deftest-gather-strings-from-list
(funcall imenu-create-index-function))
#'string-lessp))
(expected-items (sort (copy-sequence ,expected-items) #'string-lessp)))
- (should (equal result-items expected-items))
- )))))
+ (should (equal result-items expected-items)))))))
(imenu-simple-scan-deftest sh "Test imenu expression for sh-mode." sh-mode "a()
{
diff --git a/test/lisp/vc/vc-tests.el b/test/lisp/vc/vc-tests.el
index ff85e2f904e..8e5cc95ec94 100644
--- a/test/lisp/vc/vc-tests.el
+++ b/test/lisp/vc/vc-tests.el
@@ -224,11 +224,10 @@ For backends which don't support it, `vc-not-supported' is signaled."
(defmacro vc-test--run-maybe-unsupported-function (func &rest args)
"Run FUNC with ARGS as arguments.
Catch the `vc-not-supported' error."
- `(let (err)
- (condition-case err
- (funcall ,func ,@args)
- (vc-not-supported 'vc-not-supported)
- (t (signal (car err) (cdr err))))))
+ `(condition-case err
+ (funcall ,func ,@args)
+ (vc-not-supported 'vc-not-supported)
+ (t (signal (car err) (cdr err)))))
(defun vc-test--register (backend)
"Register and unregister a file.
diff --git a/test/src/undo-tests.el b/test/src/undo-tests.el
index 13335a9bb10..b26a276c61b 100644
--- a/test/src/undo-tests.el
+++ b/test/src/undo-tests.el
@@ -452,7 +452,7 @@ Demonstrates bug 25599."
(insert ";; aaaaaaaaa
;; bbbbbbbb")
(let ((overlay-modified
- (lambda (ov after-p _beg _end &optional length)
+ (lambda (ov after-p _beg _end &optional _length)
(unless after-p
(when (overlay-buffer ov)
(delete-overlay ov))))))