diff options
| author | Basil L. Contovounesios | 2020-06-21 12:50:34 +0100 |
|---|---|---|
| committer | Basil L. Contovounesios | 2020-06-21 12:50:34 +0100 |
| commit | 4cc6854cd4b0857e223ed6bc1b1b1a051dd83480 (patch) | |
| tree | 4809d5c25c6be4ebfb78099b30d26f564bf1e7b5 | |
| parent | a1b487eac0ec10059eb2b8c5e7efc9eec1342148 (diff) | |
| download | emacs-4cc6854cd4b0857e223ed6bc1b1b1a051dd83480.tar.gz emacs-4cc6854cd4b0857e223ed6bc1b1b1a051dd83480.zip | |
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.
| -rw-r--r-- | test/lisp/emacs-lisp/package-tests.el | 24 | ||||
| -rw-r--r-- | test/lisp/imenu-tests.el | 15 | ||||
| -rw-r--r-- | test/lisp/vc/vc-tests.el | 9 | ||||
| -rw-r--r-- | test/src/undo-tests.el | 2 |
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 @@ | |||
| 176 | (defun package-test-suffix-matches (base suffix-list) | 176 | (defun package-test-suffix-matches (base suffix-list) |
| 177 | "Return file names matching BASE concatenated with each item in SUFFIX-LIST" | 177 | "Return file names matching BASE concatenated with each item in SUFFIX-LIST" |
| 178 | (cl-mapcan | 178 | (cl-mapcan |
| 179 | '(lambda (item) (file-expand-wildcards (concat base item))) | 179 | (lambda (item) (file-expand-wildcards (concat base item))) |
| 180 | suffix-list)) | 180 | suffix-list)) |
| 181 | 181 | ||
| 182 | (defvar tar-parse-info) | 182 | (defvar tar-parse-info) |
| @@ -419,17 +419,17 @@ Must called from within a `tar-mode' buffer." | |||
| 419 | (ert-deftest package-test-list-filter-marked () | 419 | (ert-deftest package-test-list-filter-marked () |
| 420 | "Ensure package list is filtered correctly by non-empty mark." | 420 | "Ensure package list is filtered correctly by non-empty mark." |
| 421 | (with-package-test () | 421 | (with-package-test () |
| 422 | (let ((buf (package-list-packages))) | 422 | (package-list-packages) |
| 423 | (revert-buffer) | 423 | (revert-buffer) |
| 424 | (search-forward-regexp "^ +simple-single") | 424 | (search-forward-regexp "^ +simple-single") |
| 425 | (package-menu-mark-install) | 425 | (package-menu-mark-install) |
| 426 | (package-menu-filter-marked) | 426 | (package-menu-filter-marked) |
| 427 | (goto-char (point-min)) | 427 | (goto-char (point-min)) |
| 428 | (should (re-search-forward "^I +simple-single" nil t)) | 428 | (should (re-search-forward "^I +simple-single" nil t)) |
| 429 | (should (= (count-lines (point-min) (point-max)) 1)) | 429 | (should (= (count-lines (point-min) (point-max)) 1)) |
| 430 | (package-menu-mark-unmark) | 430 | (package-menu-mark-unmark) |
| 431 | ;; No marked packages in default environment. | 431 | ;; No marked packages in default environment. |
| 432 | (should-error (package-menu-filter-marked))))) | 432 | (should-error (package-menu-filter-marked)))) |
| 433 | 433 | ||
| 434 | (ert-deftest package-test-list-filter-by-version () | 434 | (ert-deftest package-test-list-filter-by-version () |
| 435 | (with-package-menu-test | 435 | (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 @@ | |||
| 50 | (setq input (cdr input))))) | 50 | (setq input (cdr input))))) |
| 51 | result)) | 51 | result)) |
| 52 | 52 | ||
| 53 | (defmacro imenu-simple-scan-deftest (name doc major-mode content expected-items) | 53 | (defmacro imenu-simple-scan-deftest (name doc mode content expected-items) |
| 54 | "Generate an ert test for mode-own imenu expression. | 54 | "Generate an ert test for mode-own imenu expression. |
| 55 | Run `imenu-create-index-function' at the buffer which content is | 55 | Run `imenu-create-index-function' at the buffer which content is |
| 56 | CONTENT with MAJOR-MODE. A generated test runs `imenu-create-index-function' | 56 | CONTENT with major MODE. A generated test runs `imenu-create-index-function' |
| 57 | at the buffer which content is CONTENT with MAJOR-MODE. Then it compares a list | 57 | at the buffer which content is CONTENT with major MODE. Then it compares a |
| 58 | of strings which are picked up from the result with EXPECTED-ITEMS." | 58 | list of strings which are picked up from the result with EXPECTED-ITEMS." |
| 59 | (let ((xname (intern (concat "imenu-simple-scan-deftest-" (symbol-name name))))) | 59 | (let ((xname (intern (concat "imenu-simple-scan-deftest-" (symbol-name name))))) |
| 60 | `(ert-deftest ,xname () | 60 | `(ert-deftest ,xname () |
| 61 | ,doc | 61 | ,doc |
| 62 | (with-temp-buffer | 62 | (with-temp-buffer |
| 63 | (insert ,content) | 63 | (insert ,content) |
| 64 | (funcall ',major-mode) | 64 | (funcall #',mode) |
| 65 | (let ((result-items (sort (imenu-simple-scan-deftest-gather-strings-from-list | 65 | (let ((result-items (sort (imenu-simple-scan-deftest-gather-strings-from-list |
| 66 | (funcall imenu-create-index-function)) | 66 | (funcall imenu-create-index-function)) |
| 67 | #'string-lessp)) | 67 | #'string-lessp)) |
| 68 | (expected-items (sort (copy-sequence ,expected-items) #'string-lessp))) | 68 | (expected-items (sort (copy-sequence ,expected-items) #'string-lessp))) |
| 69 | (should (equal result-items expected-items)) | 69 | (should (equal result-items expected-items))))))) |
| 70 | ))))) | ||
| 71 | 70 | ||
| 72 | (imenu-simple-scan-deftest sh "Test imenu expression for sh-mode." sh-mode "a() | 71 | (imenu-simple-scan-deftest sh "Test imenu expression for sh-mode." sh-mode "a() |
| 73 | { | 72 | { |
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." | |||
| 224 | (defmacro vc-test--run-maybe-unsupported-function (func &rest args) | 224 | (defmacro vc-test--run-maybe-unsupported-function (func &rest args) |
| 225 | "Run FUNC with ARGS as arguments. | 225 | "Run FUNC with ARGS as arguments. |
| 226 | Catch the `vc-not-supported' error." | 226 | Catch the `vc-not-supported' error." |
| 227 | `(let (err) | 227 | `(condition-case err |
| 228 | (condition-case err | 228 | (funcall ,func ,@args) |
| 229 | (funcall ,func ,@args) | 229 | (vc-not-supported 'vc-not-supported) |
| 230 | (vc-not-supported 'vc-not-supported) | 230 | (t (signal (car err) (cdr err))))) |
| 231 | (t (signal (car err) (cdr err)))))) | ||
| 232 | 231 | ||
| 233 | (defun vc-test--register (backend) | 232 | (defun vc-test--register (backend) |
| 234 | "Register and unregister a file. | 233 | "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." | |||
| 452 | (insert ";; aaaaaaaaa | 452 | (insert ";; aaaaaaaaa |
| 453 | ;; bbbbbbbb") | 453 | ;; bbbbbbbb") |
| 454 | (let ((overlay-modified | 454 | (let ((overlay-modified |
| 455 | (lambda (ov after-p _beg _end &optional length) | 455 | (lambda (ov after-p _beg _end &optional _length) |
| 456 | (unless after-p | 456 | (unless after-p |
| 457 | (when (overlay-buffer ov) | 457 | (when (overlay-buffer ov) |
| 458 | (delete-overlay ov)))))) | 458 | (delete-overlay ov)))))) |