]> git.eshelyaron.com Git - emacs.git/commitdiff
Run ERT tests with `lexical-binding` bound to `t`
authorMattias Engdegård <mattiase@acm.org>
Mon, 4 Oct 2021 16:11:40 +0000 (18:11 +0200)
committerMattias Engdegård <mattiase@acm.org>
Mon, 4 Oct 2021 16:11:40 +0000 (18:11 +0200)
* lisp/emacs-lisp/ert.el (ert-deftest, ert--run-test-internal):
Use t rather than the ambient file value for `lexical-binding` to
avoid bad lexbind coverage by mistake.

lisp/emacs-lisp/ert.el

index f2b20fd74e5b116450cf4d2420e695f6235c52ef..607f15d254ffaa259b4d8d6b7b2b4e4f9afd7bf7 100644 (file)
@@ -219,11 +219,7 @@ it has to be wrapped in `(eval (quote ...))'.
                             `(:expected-result-type ,expected-result))
                         ,@(when tags-supplied-p
                             `(:tags ,tags))
-                        :body (lambda ()
-                                ;; Use the value of `lexical-binding' in
-                                ;; the source file when evaluating the body.
-                                (let ((lexical-binding ,lexical-binding))
-                                  ,@body))))
+                        :body (lambda () ,@body)))
          ',name))))
 
 (defvar ert--find-test-regexp
@@ -780,7 +776,8 @@ This mainly sets up debugger-related bindings."
         ;; handle ert errors. Once that's done, remove
         ;; `ert--should-signal-hook'.  See Bug#24402 and Bug#11218 for
         ;; details.
-        (let ((debugger (lambda (&rest args)
+        (let ((lexical-binding t)
+              (debugger (lambda (&rest args)
                           (ert--run-test-debugger test-execution-info
                                                   args)))
               (debug-on-error t)