[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/buttercup d41c6dc 301/340: Extract buttercup-reporter-batc
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/buttercup d41c6dc 301/340: Extract buttercup-reporter-batch--print-summary |
Date: |
Thu, 16 Dec 2021 14:59:55 -0500 (EST) |
branch: elpa/buttercup
commit d41c6dcc81f8e8634b09acf8ce245bd99fc58930
Author: Ola Nilsson <ola.nilsson@gmail.com>
Commit: Ola Nilsson <ola.nilsson@gmail.com>
Extract buttercup-reporter-batch--print-summary
... from the batch reporters
---
buttercup.el | 61 +++++++++++++++++--------------------------------
tests/test-buttercup.el | 4 ++--
2 files changed, 23 insertions(+), 42 deletions(-)
diff --git a/buttercup.el b/buttercup.el
index dbfb21b..530569e 100644
--- a/buttercup.el
+++ b/buttercup.el
@@ -1658,27 +1658,30 @@ EVENT and ARG are described in `buttercup-reporter'."
(t
(buttercup--print "FAILED: %S\n" description)))
(buttercup--print "\n")))
- (let ((defined (buttercup-suites-total-specs-defined arg))
- (pending (buttercup-suites-total-specs-pending arg))
- (failed (buttercup-suites-total-specs-failed arg))
- (duration (float-time (time-subtract
- (current-time)
- buttercup-reporter-batch--start-time))))
- (if (> pending 0)
- (buttercup--print
- "Ran %s out of %s specs, %s failed, in %s.\n"
- (- defined pending)
- defined
- failed
- (seconds-to-string duration))
- (buttercup--print "Ran %s specs, %s failed, in %s.\n"
- defined
- failed
- (seconds-to-string duration)))))
+ (buttercup-reporter-batch--print-summary arg nil))
(_
(error "Unknown event %s" event)))))
+(defun buttercup-reporter-batch--print-summary (suites color)
+ "Print a summary of the reults of SUITES.
+
+Colorize parts of the output if COLOR is non-nil."
+ (let* ((defined (buttercup-suites-total-specs-defined suites))
+ (pending (buttercup-suites-total-specs-pending suites))
+ (failed (buttercup-suites-total-specs-failed suites))
+ (duration (seconds-to-string
+ (float-time
+ (time-subtract (current-time)
+ buttercup-reporter-batch--start-time))))
+ (out-of (if (zerop pending) "" (format " out of %d" defined)))
+ (failed-str (format "%d failed" failed)))
+ (if color
+ (setq failed-str (buttercup-colorize failed-str (if (zerop failed)
'green 'red))))
+ (buttercup--print
+ "Ran %d%s specs, %s, in %s.\n"
+ (- defined pending) out-of failed-str duration)))
+
(defun buttercup-reporter-batch-color (event arg)
"A reporter that handles batch sessions.
@@ -1740,29 +1743,7 @@ EVENT and ARG are described in `buttercup-reporter'."
(t
(buttercup--print "FAILED: %S\n" description)))
(buttercup--print "\n")))
- (let ((defined (buttercup-suites-total-specs-defined arg))
- (pending (buttercup-suites-total-specs-pending arg))
- (failed (buttercup-suites-total-specs-failed arg))
- (duration (float-time (time-subtract (current-time)
-
buttercup-reporter-batch--start-time))))
- (if (> pending 0)
- (buttercup--print
- (concat
- "Ran %s out of %s specs,"
- (buttercup-colorize " %s failed" (if (eq 0 failed) 'green 'red))
- ", in %s.\n")
- (- defined pending)
- defined
- failed
- (seconds-to-string duration))
- (buttercup--print
- (concat
- "Ran %s specs,"
- (buttercup-colorize " %s failed" (if (eq 0 failed) 'green 'red))
- ", in %s.\n")
- defined
- failed
- (seconds-to-string duration)))))
+ (buttercup-reporter-batch--print-summary arg buttercup-color))
(_
;; Fall through to buttercup-reporter-batch implementation.
diff --git a/tests/test-buttercup.el b/tests/test-buttercup.el
index 22973fc..a6774f3 100644
--- a/tests/test-buttercup.el
+++ b/tests/test-buttercup.el
@@ -1292,7 +1292,7 @@ text properties using `ansi-color-apply'."
"Ran 10 specs, 0 failed, in [0-9]+.[0-9]+[mu]?s.\n")
(expect (substring (buttercup-output) 0 (length "Ran 10 specs, 0
failed, in"))
:to-equal-including-properties
- (ansi-color-apply "Ran 10 specs,\e[32m 0 failed\e[0m, in")))
+ (ansi-color-apply "Ran 10 specs, \e[32m0 failed\e[0m, in")))
(it "should color-print `X failed' specs in red"
(setq failed-specs 6)
@@ -1302,7 +1302,7 @@ text properties using `ansi-color-apply'."
"Ran 10 specs, 6 failed, in [0-9]+.[0-9]+[mu]?s.\n")
(expect (substring (buttercup-output) 0 (length "Ran 10 specs, 6
failed, in"))
:to-equal-including-properties
- (ansi-color-apply "Ran 10 specs,\e[31m 6 failed\e[0m, in")))
+ (ansi-color-apply "Ran 10 specs, \e[31m6 failed\e[0m, in")))
(it "should print a summary separating run and pending specs"
(setq pending-specs 3)
- [nongnu] elpa/buttercup b360e35 264/340: test: Add tests for buttercup--mark-skipped, (continued)
- [nongnu] elpa/buttercup b360e35 264/340: test: Add tests for buttercup--mark-skipped, ELPA Syncer, 2021/12/16
- [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 <=
- [nongnu] elpa/buttercup 74e74e2 302/340: Extract buttercup-reporter-batch--print-failed-spec-report, ELPA Syncer, 2021/12/16
- [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