mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-15 13:01:27 +00:00
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.
This commit is contained in:
parent
89a298b3d2
commit
1c1d2eb3e3
1 changed files with 6 additions and 12 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue