mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-17 01:10:10 +00:00
Fix byte-compiler warning for failed uses of lexical vars
* lisp/emacs-lisp/bytecomp.el (byte-compile-form): Fix byte-compiler warning for failed uses of lexical vars. (Bug#44980) * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp--define-warning-file-test): Don't prefix tests with 'warn'. (bytecomp/error-lexical-var-with-add-hook\.el) (bytecomp/error-lexical-var-with-remove-hook\.el) (bytecomp/error-lexical-var-with-run-hook-with-args-until-failure\.el) (bytecomp/error-lexical-var-with-run-hook-with-args-until-success\.el) (bytecomp/error-lexical-var-with-run-hook-with-args\.el) (bytecomp/error-lexical-var-with-symbol-value\.el): New tests. * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-symbol-value.el: * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args.el: * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args-until-success.el: * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args-until-failure.el: * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-remove-hook.el: * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-add-hook.el: New files.
This commit is contained in:
parent
8a27b0cad7
commit
ace6eba036
8 changed files with 45 additions and 4 deletions
|
@ -548,7 +548,7 @@ Subtests signal errors if something goes wrong."
|
|||
(should (equal (funcall 'def) -1)))
|
||||
|
||||
(defmacro bytecomp--define-warning-file-test (file re-warning &optional reverse)
|
||||
`(ert-deftest ,(intern (format "bytecomp-warn/%s" file)) ()
|
||||
`(ert-deftest ,(intern (format "bytecomp/%s" file)) ()
|
||||
:expected-result ,(if reverse :failed :passed)
|
||||
(with-current-buffer (get-buffer-create "*Compile-Log*")
|
||||
(let ((inhibit-read-only t)) (erase-buffer))
|
||||
|
@ -556,9 +556,29 @@ Subtests signal errors if something goes wrong."
|
|||
(ert-info ((buffer-string) :prefix "buffer: ")
|
||||
(should (re-search-forward ,re-warning))))))
|
||||
|
||||
(bytecomp--define-warning-file-test "warn-free-setq.el" "free.*foo")
|
||||
(bytecomp--define-warning-file-test "error-lexical-var-with-add-hook.el"
|
||||
"add-hook.*lexical var")
|
||||
|
||||
(bytecomp--define-warning-file-test "warn-free-variable-reference.el" "free.*bar")
|
||||
(bytecomp--define-warning-file-test "error-lexical-var-with-remove-hook.el"
|
||||
"remove-hook.*lexical var")
|
||||
|
||||
(bytecomp--define-warning-file-test "error-lexical-var-with-run-hook-with-args-until-failure.el"
|
||||
"args-until-failure.*lexical var")
|
||||
|
||||
(bytecomp--define-warning-file-test "error-lexical-var-with-run-hook-with-args-until-success.el"
|
||||
"args-until-success.*lexical var")
|
||||
|
||||
(bytecomp--define-warning-file-test "error-lexical-var-with-run-hook-with-args.el"
|
||||
"args.*lexical var")
|
||||
|
||||
(bytecomp--define-warning-file-test "error-lexical-var-with-symbol-value.el"
|
||||
"symbol-value.*lexical var")
|
||||
|
||||
(bytecomp--define-warning-file-test "warn-free-setq.el"
|
||||
"free.*foo")
|
||||
|
||||
(bytecomp--define-warning-file-test "warn-free-variable-reference.el"
|
||||
"free.*bar")
|
||||
|
||||
(bytecomp--define-warning-file-test "warn-obsolete-defun.el"
|
||||
"foo-obsolete.*obsolete function.*99.99")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue