summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2023-12-27 11:32:49 +0100
committerStefan Monnier <monnier@iro.umontreal.ca>2024-01-04 16:35:53 -0500
commitfa1063774ce32714365cf122b2a8cca2d23fc6cd (patch)
treeac02e6863a8e5c0f7a6e5b77487db57f1171702f /test/lisp/emacs-lisp
parent25ea99c211ecf91735b44172da19fc53b304c5f4 (diff)
downloademacs-fa1063774ce32714365cf122b2a8cca2d23fc6cd.tar.gz
emacs-fa1063774ce32714365cf122b2a8cca2d23fc6cd.tar.bz2
emacs-fa1063774ce32714365cf122b2a8cca2d23fc6cd.zip
Use handler-bind to repair bytecomp-tests
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--error-frame, bytecomp--byte-op-error-backtrace): Make test pass again and simplify, using handler-bind instead of the previous debugger hack.
Diffstat (limited to 'test/lisp/emacs-lisp')
-rw-r--r--test/lisp/emacs-lisp/bytecomp-tests.el18
1 files changed, 6 insertions, 12 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index 293d3025420..dcb72e4105a 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -2087,18 +2087,12 @@ EXPECTED-POINT BINDINGS (MODES \\='\\='(ruby-mode js-mode python-mode)) \
(defun bytecomp-tests--error-frame (fun args)
"Call FUN with ARGS. Return result or (ERROR . BACKTRACE-FRAME)."
- (let* ((debugger
- (lambda (&rest args)
- ;; Make sure Emacs doesn't think our debugger is buggy.
- (cl-incf num-nonmacro-input-events)
- (throw 'bytecomp-tests--backtrace
- (cons args (cadr (backtrace-get-frames debugger))))))
- (debug-on-error t)
- (backtrace-on-error-noninteractive nil)
- (debug-on-quit t)
- (debug-ignored-errors nil))
+ (letrec ((handler (lambda (e)
+ (throw 'bytecomp-tests--backtrace
+ (cons e (cadr (backtrace-get-frames handler)))))))
(catch 'bytecomp-tests--backtrace
- (apply fun args))))
+ (handler-bind ((error handler))
+ (apply fun args)))))
(defconst bytecomp-tests--byte-op-error-cases
'(((car a) (wrong-type-argument listp a))
@@ -2143,7 +2137,7 @@ EXPECTED-POINT BINDINGS (MODES \\='\\='(ruby-mode js-mode python-mode)) \
`(lambda ,formals (,fun-sym ,@formals)))))))
(error-frame (bytecomp-tests--error-frame fun actuals)))
(should (consp error-frame))
- (should (equal (car error-frame) (list 'error expected-error)))
+ (should (equal (car error-frame) expected-error))
(let ((frame (cdr error-frame)))
(should (equal (type-of frame) 'backtrace-frame))
(should (equal (cons (backtrace-frame-fun frame)