emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 33bcd4f2d28 1/4: Ignore ert-deftest body value


From: Mattias Engdegård
Subject: master 33bcd4f2d28 1/4: Ignore ert-deftest body value
Date: Mon, 14 Aug 2023 11:04:25 -0400 (EDT)

branch: master
commit 33bcd4f2d28a7101dbc0ea5563e99cd7f117e21b
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>

    Ignore ert-deftest body value
    
    * 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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index be9f013ebcf..4ea894f4ede 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -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))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]