[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/buttercup 74e74e2 302/340: Extract buttercup-reporter-batc
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/buttercup 74e74e2 302/340: Extract buttercup-reporter-batch--print-failed-spec-report |
Date: |
Thu, 16 Dec 2021 14:59:55 -0500 (EST) |
branch: elpa/buttercup
commit 74e74e2e2e543f5101b7e5a532e4ccaa6d46be55
Author: Ola Nilsson <ola.nilsson@gmail.com>
Commit: Ola Nilsson <ola.nilsson@gmail.com>
Extract buttercup-reporter-batch--print-failed-spec-report
... from the batch reporters
---
buttercup.el | 72 ++++++++++++++++++++++++++++--------------------------------
1 file changed, 33 insertions(+), 39 deletions(-)
diff --git a/buttercup.el b/buttercup.el
index 530569e..0a21aa9 100644
--- a/buttercup.el
+++ b/buttercup.el
@@ -1639,30 +1639,43 @@ EVENT and ARG are described in `buttercup-reporter'."
(`buttercup-done
(dolist (failed buttercup-reporter-batch--failures)
- (let ((description (buttercup-spec-failure-description failed))
- (stack (buttercup-spec-failure-stack failed)))
- (buttercup--print "%s\n" (make-string 40 ?=))
- (buttercup--print "%s\n" (buttercup-spec-full-name failed))
- (when stack
- (buttercup--print "\nTraceback (most recent call last):\n")
- (dolist (frame stack)
- (let ((frame-text (buttercup--format-stack-frame frame)))
- (buttercup--print "%s\n" frame-text))))
- (cond
- ((stringp description)
- (buttercup--print "FAILED: %s\n" description))
- ((eq (car description) 'error)
- (buttercup--print "%S: %S\n\n"
- (car description)
- (cadr description)))
- (t
- (buttercup--print "FAILED: %S\n" description)))
- (buttercup--print "\n")))
+ (buttercup-reporter-batch--print-failed-spec-report failed nil))
(buttercup-reporter-batch--print-summary arg nil))
(_
(error "Unknown event %s" event)))))
+(defun buttercup-reporter-batch--print-failed-spec-report (failed-spec color)
+ "Print a failure report for FAILED-SPEC.
+
+Colorize parts of the output if COLOR is non-nil."
+ (let ((description (buttercup-spec-failure-description failed-spec))
+ (stack (buttercup-spec-failure-stack failed-spec))
+ (full-name (buttercup-spec-full-name failed-spec)))
+ (if color
+ (setq full-name (buttercup-colorize full-name 'red)))
+ (buttercup--print "%s\n" (make-string 40 ?=))
+ (buttercup--print "%s\n" full-name)
+ (when stack
+ (buttercup--print "\nTraceback (most recent call last):\n")
+ (dolist (frame stack)
+ (let ((frame-text (buttercup--format-stack-frame frame)))
+ (buttercup--print "%s\n" frame-text))))
+ (cond
+ ((stringp description)
+ (buttercup--print "%s: %s\n"
+ (if color
+ (buttercup-colorize "FAILED" 'red)
+ "FAILED")
+ description))
+ ((eq (car description) 'error)
+ (buttercup--print "%S: %S\n\n"
+ (car description)
+ (cadr description)))
+ (t
+ (buttercup--print "FAILED: %S\n" description)))
+ (buttercup--print "\n")))
+
(defun buttercup-reporter-batch--print-summary (suites color)
"Print a summary of the reults of SUITES.
@@ -1723,26 +1736,7 @@ EVENT and ARG are described in `buttercup-reporter'."
(`buttercup-done
(dolist (failed buttercup-reporter-batch--failures)
- (let ((description (buttercup-spec-failure-description failed))
- (stack (buttercup-spec-failure-stack failed)))
- (buttercup--print "%s\n" (make-string 40 ?=))
- (buttercup--print (buttercup-colorize "%s\n" 'red)
(buttercup-spec-full-name failed))
- (when stack
- (buttercup--print "\nTraceback (most recent call last):\n")
- (dolist (frame stack)
- (let ((frame-text (buttercup--format-stack-frame frame)))
- (buttercup--print "%s\n" frame-text))))
- (cond
- ((stringp description)
- (buttercup--print (concat (buttercup-colorize "FAILED" 'red ) ":
%s\n")
- description))
- ((eq (car description) 'error)
- (buttercup--print "%S: %S\n\n"
- (car description)
- (cadr description)))
- (t
- (buttercup--print "FAILED: %S\n" description)))
- (buttercup--print "\n")))
+ (buttercup-reporter-batch--print-failed-spec-report failed t))
(buttercup-reporter-batch--print-summary arg buttercup-color))
(_
- [nongnu] elpa/buttercup 9b94921 276/340: test: Add tests for buttercup-reporter-batch buttercup-done handling, (continued)
- [nongnu] elpa/buttercup 9b94921 276/340: test: Add tests for buttercup-reporter-batch buttercup-done handling, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 2040757 277/340: test: Add reporter test for buttercup-started with pending specs, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup a91f282 283/340: Handle multiline spec descriptions in buttercup-reporter-batch-color, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 532d082 284/340: test: Fix tab stops in send-string-to-ansi-buffer for Emacs 24.3, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 8afc407 286/340: Switch from to pcase for spec-done in buttercup-reporter-batch-color, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d5c3ed5 289/340: Switch to Github Actions, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 41424d5 292/340: Add new public function buttercup-mark-skipped, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 5752a57 295/340: Control errors from buttercup-run with noerror argument, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 2d77e18 300/340: test: Correct descriptions for some suite-done specs, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d41c6dc 301/340: Extract buttercup-reporter-batch--print-summary, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 74e74e2 302/340: Extract buttercup-reporter-batch--print-failed-spec-report,
ELPA Syncer <=
- [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