emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/buttercup c8f34ae3ed 05/16: Limit backtraces for spec exce


From: ELPA Syncer
Subject: [nongnu] elpa/buttercup c8f34ae3ed 05/16: Limit backtraces for spec exceptions outside expect
Date: Wed, 4 Sep 2024 18:59:24 -0400 (EDT)

branch: elpa/buttercup
commit c8f34ae3edda96f1dab7b7d9e9ed2692c0ee7263
Author: Ola Nilsson <ola.nilsson@gmail.com>
Commit: Ola Nilsson <ola.nilsson@gmail.com>

    Limit backtraces for spec exceptions outside expect
    
    The first uninteresting frame is identified by a new
    `buttercup--stackframe-marker' in a let statement:
    
       (let ((buttercup--stackframe-marker 1)) ...
    
    This let-form is added to the buttercup-with-converted-ert-signals
    macro, not because it has anything to do with ert signal conversion,
    but because it is the last wrapper around the spec code given by the
    user.
---
 buttercup.el | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/buttercup.el b/buttercup.el
index 7f30f2c38d..b1107a9df1 100644
--- a/buttercup.el
+++ b/buttercup.el
@@ -2129,7 +2129,20 @@ ARGS according to `debugger'."
            ;; When the error occurs in the calling of one of the
            ;; wrapped expressions of an expect.
            (buttercup--wrapper-fun-p (cadr frame))
-           ;; TODO: error in `it' but outside `expect'
+           ;; When an error happens in spec code but outside an expect
+           ;; statement
+           ;; buttercup--update-with-funcall
+           ;;  apply buttercup--funcall
+           ;;   buttercup--funcall   -   sets debugger
+           ;;    apply FUNCTION
+           ;;     FUNCTION  -- spec body function
+           ;;      condition-case   -- from 
buttercup-with-converted-ert-signals
+           ;;       (let ((buttercup--stackframe-marker 1))  -- the same
+           ;;        ACTUAL CODE
+           (and (null (car frame))
+                (eq 'let (cadr frame))
+                (equal '((buttercup--stackframe-marker 1)) (car (cddr frame)))
+                )
            ;; TODO: What about an error in a matcher?
            ;; TODO: What about :to-throw?
            ;; TODO: What about signals in before and after blocks?
@@ -2184,7 +2197,9 @@ Specifically, `ert-test-failed' is converted to
 `buttercup-pending'."
   (declare (indent 0))
   `(condition-case err
-       (progn ,@body)
+       (let ((buttercup--stackframe-marker 1))
+         (ignore buttercup--stackframe-marker)
+         ,@body)
      (ert-test-failed
       (buttercup-fail "%S" err))
      (ert-test-skipped



reply via email to

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