]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't call ERT explainer on error
authorMattias Engdegård <mattiase@acm.org>
Thu, 24 Jun 2021 18:48:41 +0000 (20:48 +0200)
committerMattias Engdegård <mattiase@acm.org>
Thu, 24 Jun 2021 18:48:41 +0000 (20:48 +0200)
* lisp/emacs-lisp/ert.el (ert--expand-should-1): If the predicate form
signals an error, don't call an explainer because the arguments passed
(the error and error argument, respectively) do not make any sense to
the explainer at all.

lisp/emacs-lisp/ert.el

index 6793b374eeabdf0a4e63321d9898635a955416c1..7de07bd6f53b336551112d6fdde009c2b62df10f 100644 (file)
@@ -313,12 +313,13 @@ It should only be stopped when ran from inside ert--run-test-internal."
                                  (list :form `(,,fn ,@,args))
                                  (unless (eql ,value ',default-value)
                                    (list :value ,value))
-                                 (let ((-explainer-
-                                        (and (symbolp ',fn-name)
-                                             (get ',fn-name 'ert-explainer))))
-                                   (when -explainer-
-                                     (list :explanation
-                                           (apply -explainer- ,args)))))
+                                 (unless (eql ,value ',default-value)
+                                   (let ((-explainer-
+                                          (and (symbolp ',fn-name)
+                                               (get ',fn-name 'ert-explainer))))
+                                     (when -explainer-
+                                       (list :explanation
+                                             (apply -explainer- ,args))))))
                          value)
                ,value))))))))