[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/buttercup 315a891 326/340: Fix stack frame collection in b
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/buttercup 315a891 326/340: Fix stack frame collection in buttercup--backtrace |
Date: |
Thu, 16 Dec 2021 15:00:00 -0500 (EST) |
branch: elpa/buttercup
commit 315a891f8ab68800d57c3a50fed6a58364652a53
Author: Ola Nilsson <ola.nilsson@gmail.com>
Commit: Ola Nilsson <ola.nilsson@gmail.com>
Fix stack frame collection in buttercup--backtrace
Changes to the inner workings of buttercup has made the condition for
when to stop collecting frames out-of-date. Looking for
buttercup--funcall is no longer enough; buttercup--expr-and-value and
buttercup--apply-matcher must alse be used. The number of frames to
discard depends on which of these functions is found.
The frame inspection loop is rewritten using cl-do*, which allows for
early exit with cl-return.
---
buttercup.el | 33 +++++++++++++++++++++------------
1 file changed, 21 insertions(+), 12 deletions(-)
diff --git a/buttercup.el b/buttercup.el
index c7ec197..40efbd3 100644
--- a/buttercup.el
+++ b/buttercup.el
@@ -1923,23 +1923,32 @@ ARGS according to `debugger'."
(defun buttercup--backtrace ()
"Create a backtrace, a list of frames returned from `backtrace-frame'."
- (let* ((n 0)
- (frame (backtrace-frame n))
- (frame-list nil)
- (in-program-stack nil))
- (while frame
+ ;; Read the backtrace frames from 0 (the closest) upward.
+ (cl-do* ((n 0 (1+ n))
+ (frame (backtrace-frame n) (backtrace-frame n))
+ (frame-list nil)
+ (in-program-stack nil)
+ (discard-frames nil))
+ ((not frame) frame-list)
+ ;; discard frames until (and including) `buttercup--debugger', they
+ ;; only contain buttercup code
(when in-program-stack
(push frame frame-list))
(when (eq (elt frame 1)
'buttercup--debugger)
(setq in-program-stack t))
- (when (eq (elt frame 1)
- 'buttercup--funcall)
- (setq in-program-stack nil
- frame-list (nthcdr 6 frame-list)))
- (setq n (1+ n)
- frame (backtrace-frame n)))
- frame-list))
+ ;; keep frames until one of the known functions are found, after
+ ;; this is just the buttercup framework and not interesting for
+ ;; users incorrect for testing buttercup. Some frames before the
+ ;; function also have to be discarded
+ (when (and in-program-stack
+ (setq discard-frames
+ (pcase (elt frame 1)
+ (`buttercup--expr-and-value 2) ; matcher modified
with :not
+ (`buttercup--apply-matcher 4) ; unmodified matcher
+ (`buttercup--funcall 6))))
+ (setq frame-list (nthcdr discard-frames frame-list))
+ (cl-return frame-list))))
(defun buttercup--format-stack-frame (frame &optional style)
"Format stack FRAME according to STYLE.
- [nongnu] elpa/buttercup 52f0bec 305/340: Make buttercup-colorize treat nil as no color, (continued)
- [nongnu] elpa/buttercup 52f0bec 305/340: Make buttercup-colorize treat nil as no color, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup a8f4cff 311/340: test: Correct descriptions for ERT compatibility specs, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 995a4f1 312/340: Add missing docstrings, correct some other docstrings, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 110a9b6 314/340: test: Use pretty traceback, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup a9647cb 316/340: Bump version: 1.22 → 1.23, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup b76ff35 317/340: Update buttercup.bat to handle all options, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 62a34c7 322/340: Remove elc files in tests on make clean, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 0e5eae0 321/340: Merge pull request #192 from snogge/re-patterns, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup e0b5d9f 324/340: Correct error message in buttercup--format-stack-frame, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 843fa6f 327/340: Keep the actual variable definition with the reporter, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 315a891 326/340: Fix stack frame collection in buttercup--backtrace,
ELPA Syncer <=
- [nongnu] elpa/buttercup cccdedf 334/340: Merge pull request #197 from snogge/omit-traceback, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup bef49f5 323/340: Remove extra newline in error backtrace, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 6ef715f 328/340: Use buttercup--mark-stackframe to mark the start of test code, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 2f24a44 338/340: Make formatting of backtrace frames closer to that standard for Emacs, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup f6f9335 337/340: test: Add tests for buttercup-run-discovery, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 553ff83 103/340: Add :to-have-same-items-as to compare lists as sets., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 657acef 102/340: Bump version: 1.4 → 1.5, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 7e8898b 127/340: Implement :to-have-been-called-times matcher (close #90), ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup ca09040 130/340: Improve the Makefile, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup a535e51 134/340: Fix a logic error in spy tests, ELPA Syncer, 2021/12/16