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.
parent a1b487ea
......@@ -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
......
......@@ -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()
{
......
......@@ -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.
......
......@@ -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))))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment