Do call debugger on failed cl-assert
"Don't call debug on failed cl-assert..." removed the call to `debug' in cl--assertion-failed because `debug' calls `kill-emacs' in batch mode, thus messing up ert test runs. However, calling the debugger is useful because it allows catching failed assertions even inside `condition-case' calls. The problem with ert can be avoided by calling `debugger' instead of `debug' directly, since ert installs its own debugger while running tests. * lisp/emacs-lisp/cl-preloaded.el (cl--assertion-failed): Call `debugger' if `debug-on-error' is non-nil.
This commit is contained in:
@@ -44,9 +44,11 @@
|
|||||||
(define-error 'cl-assertion-failed (purecopy "Assertion failed"))
|
(define-error 'cl-assertion-failed (purecopy "Assertion failed"))
|
||||||
|
|
||||||
(defun cl--assertion-failed (form &optional string sargs args)
|
(defun cl--assertion-failed (form &optional string sargs args)
|
||||||
(if string
|
(if debug-on-error
|
||||||
(apply #'error string (append sargs args))
|
(funcall debugger `(cl-assertion-failed ,form ,string ,@sargs))
|
||||||
(signal 'cl-assertion-failed `(,form ,@sargs))))
|
(if string
|
||||||
|
(apply #'error string (append sargs args))
|
||||||
|
(signal 'cl-assertion-failed `(,form ,@sargs)))))
|
||||||
|
|
||||||
;; When we load this (compiled) file during pre-loading, the cl--struct-class
|
;; When we load this (compiled) file during pre-loading, the cl--struct-class
|
||||||
;; code below will need to access the `cl-struct' info, since it's considered
|
;; code below will need to access the `cl-struct' info, since it's considered
|
||||||
|
|||||||
Reference in New Issue
Block a user