emacs-diffs
[Top][All Lists]
Advanced

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

scratch/handler-bind dcf7508c947 04/10: emacs-module-tests.el (mod-test-


From: Stefan Monnier
Subject: scratch/handler-bind dcf7508c947 04/10: emacs-module-tests.el (mod-test-non-local-exit-signal-test): Repair test
Date: Thu, 28 Dec 2023 01:01:05 -0500 (EST)

branch: scratch/handler-bind
commit dcf7508c947359866151171a840d99d939c35cdf
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    emacs-module-tests.el (mod-test-non-local-exit-signal-test): Repair test
    
    That test relied on `debugger` and `debug-on-signal` in a way that
    doesn't work with the new ERT code.
    
    * test/src/emacs-module-tests.el (mod-test-non-local-exit-signal-test):
    Use `handler-bind` rather than the debugger.
---
 test/src/emacs-module-tests.el | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el
index 59af5d9a4a8..2dac5063840 100644
--- a/test/src/emacs-module-tests.el
+++ b/test/src/emacs-module-tests.el
@@ -114,15 +114,14 @@ changes."
 
 (ert-deftest mod-test-non-local-exit-signal-test ()
   (should-error (mod-test-signal))
-  (let (debugger-args backtrace)
+  (let (handler-err backtrace)
     (should-error
-     (let ((debugger (lambda (&rest args)
-                       (setq debugger-args args
-                             backtrace (with-output-to-string (backtrace)))
-                       (cl-incf num-nonmacro-input-events)))
-           (debug-on-signal t))
+     (handler-bind
+         ((error (lambda (err)
+                   (setq handler-err err
+                         backtrace (with-output-to-string (backtrace))))))
        (mod-test-signal)))
-    (should (equal debugger-args '(error (error . 56))))
+    (should (equal handler-err '(error . 56)))
     (should (string-match-p
              (rx bol "  mod-test-signal()" eol)
              backtrace))))



reply via email to

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