]> git.eshelyaron.com Git - emacs.git/commitdiff
Ignore ert-deftest body value
authorMattias Engdegård <mattiase@acm.org>
Mon, 14 Aug 2023 14:48:05 +0000 (16:48 +0200)
committerMattias Engdegård <mattiase@acm.org>
Mon, 14 Aug 2023 15:03:44 +0000 (17:03 +0200)
* lisp/emacs-lisp/ert.el (ert-deftest):
Since the return value of the body isn't going to be used, ignore
it explicitly so that the compiler can warn if we try to return
something anyway.  In particular, this exposes some comparisons
whose result weren't actually checked.

lisp/emacs-lisp/ert.el

index be9f013ebcf3b32e06b7910429f26f75ef05292d..4ea894f4ede99559a8a48c8fc6dba8dce9901e5d 100644 (file)
@@ -237,7 +237,9 @@ in batch mode, an error is signaled.
                             `(:expected-result-type ,expected-result))
                         ,@(when tags-supplied-p
                             `(:tags ,tags))
-                        :body (lambda () ,@body)
+                        ;; Add `nil' after the body to enable compiler warnings
+                        ;; about unused computations at the end.
+                        :body (lambda () ,@body nil)
                         :file-name ,(or (macroexp-file-name) buffer-file-name)))
          ',name))))