[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/buttercup 0debeec 299/340: test: Use with-local-buttercup
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/buttercup 0debeec 299/340: test: Use with-local-buttercup in more tests |
Date: |
Thu, 16 Dec 2021 14:59:54 -0500 (EST) |
branch: elpa/buttercup
commit 0debeecf2fb6e9f3495f36c70b546c83c1e5b6c8
Author: Ola Nilsson <ola.nilsson@gmail.com>
Commit: Ola Nilsson <ola.nilsson@gmail.com>
test: Use with-local-buttercup in more tests
Use the :color keyword for the batch tests to make sure
buttercup-color is correctly set for the batch reporter variant.
The reporters will soon get new variables to customize its behaviour.
As a result, more tests will need to execute in a clean buttercup
environment.
---
tests/test-buttercup.el | 75 +++++++++++++++++++++++++++++--------------------
1 file changed, 44 insertions(+), 31 deletions(-)
diff --git a/tests/test-buttercup.el b/tests/test-buttercup.el
index 431d611..907dc18 100644
--- a/tests/test-buttercup.el
+++ b/tests/test-buttercup.el
@@ -53,6 +53,7 @@ Keyword arguments kan be used to override the values of
`buttercup-KEY'.
buttercup--current-suite
(buttercup-reporter #'ignore)
buttercup-suites
+ buttercup-reporter-batch--failures
(buttercup-warning-buffer-name " *ignored buttercup warnings*")
,@(nreverse extra-vars))
,@body)))
@@ -1108,43 +1109,47 @@ text properties using `ansi-color-apply'."
(setq skipped (make-buttercup-spec :description "skipped" :status
'pending)))
(it "should print the number of specs"
- (let ((buttercup-reporter-batch--failures nil))
+ (with-local-buttercup :color nil
(buttercup-reporter-batch 'buttercup-started (list parent-suite)))
(expect (buttercup-output) :to-equal-including-properties "Running 1
specs.\n\n"))
(it "should color-print the number of specs with the default color"
- (let (buttercup-reporter-batch--failures)
+ (with-local-buttercup :color t
(buttercup-reporter-batch-color 'buttercup-started (list
parent-suite)))
(expect (buttercup-output) :to-equal-including-properties "Running 1
specs.\n\n"))
(it "should print the number of skipped specs"
- (let ((buttercup-reporter-batch--failures nil))
+ (with-local-buttercup :color nil
(buttercup-suite-add-child child-suite skipped)
(buttercup-reporter-batch 'buttercup-started (list parent-suite)))
(expect (buttercup-output) :to-equal-including-properties "Running 1
out of 2 specs.\n\n"))
(it "should color-print the number of skipped specs with the default
color"
- (let (buttercup-reporter-batch--failures)
+ (with-local-buttercup :color t
(buttercup-suite-add-child child-suite skipped)
(buttercup-reporter-batch-color 'buttercup-started (list
parent-suite)))
(expect (buttercup-output) :to-equal-including-properties "Running 1
out of 2 specs.\n\n")))
(describe "on the suite-started event"
(it "should emit an indented suite description"
- (buttercup-reporter-batch 'suite-started child-suite)
+ (with-local-buttercup :color nil
+ (buttercup-reporter-batch 'suite-started child-suite))
(expect (buttercup-output) :to-equal-including-properties "
child-suite\n"))
(it "should color-print an indented suite description with the default
color"
- (buttercup-reporter-batch-color 'suite-started child-suite)
+ (with-local-buttercup :color t
+ (buttercup-reporter-batch-color 'suite-started child-suite))
(expect (buttercup-output) :to-equal-including-properties "
child-suite\n")))
(describe "on the spec-started event"
(it "should emit an indented spec description"
- (buttercup-reporter-batch 'spec-started spec)
+ (with-local-buttercup :color nil
+ (buttercup-reporter-batch 'spec-started spec))
(expect (buttercup-output) :to-equal-including-properties " spec"))
(it "should color-print an indented spec description with the default
color"
- (buttercup-reporter-batch-color 'spec-started spec)
+ (with-local-buttercup :color t
+ (buttercup-reporter-batch-color 'spec-started spec))
(expect (buttercup-output) :to-equal-including-properties " spec")))
(describe "on the spec-done event"
@@ -1155,15 +1160,17 @@ text properties using `ansi-color-apply'."
(buttercup--set-end-time spec))
(it "should print no status tag"
- (buttercup-reporter-batch 'spec-started spec)
- (buttercup-reporter-batch 'spec-done spec)
+ (with-local-buttercup :color nil
+ (buttercup-reporter-batch 'spec-started spec)
+ (buttercup-reporter-batch 'spec-done spec))
(expect (buttercup-output) :to-equal-including-properties
(format " spec (%s)\n"
(buttercup-elapsed-time-string spec))))
(it "should color-print the description in green and no status tag"
- (buttercup-reporter-batch-color 'spec-started spec)
- (buttercup-reporter-batch-color 'spec-done spec)
+ (with-local-buttercup :color t
+ (buttercup-reporter-batch-color 'spec-started spec)
+ (buttercup-reporter-batch-color 'spec-done spec))
(expect (buttercup-output) :to-equal-including-properties
(ansi-color-apply
(format "\e[32m spec\e[0m (%s)\n"
@@ -1171,16 +1178,18 @@ text properties using `ansi-color-apply'."
(it "should print multiline specs cleanly"
(setf (buttercup-spec-description spec) "one\ntwo\vthree")
- (buttercup-reporter-batch 'spec-started spec)
- (buttercup-reporter-batch 'spec-done spec)
+ (with-local-buttercup :color nil
+ (buttercup-reporter-batch 'spec-started spec)
+ (buttercup-reporter-batch 'spec-done spec))
(expect (buttercup-output) :to-equal-including-properties
(format " one\ntwo\n three (%s)\n"
(buttercup-elapsed-time-string spec))))
(it "should color-print multiline specs cleanly"
(setf (buttercup-spec-description spec) "one\ntwo\vthree")
- (buttercup-reporter-batch-color 'spec-started spec)
- (buttercup-reporter-batch-color 'spec-done spec)
+ (with-local-buttercup :color t
+ (buttercup-reporter-batch-color 'spec-started spec)
+ (buttercup-reporter-batch-color 'spec-done spec))
(expect (buttercup-output) :to-equal-including-properties
(ansi-color-apply
(format "\e[32m one\ntwo\n three\e[0m (%s)\n"
@@ -1193,7 +1202,7 @@ text properties using `ansi-color-apply'."
(buttercup--set-end-time spec))
(it "should say FAILED"
- (let ((buttercup-reporter-batch--failures nil))
+ (with-local-buttercup :color nil
(buttercup-reporter-batch 'spec-started spec)
(buttercup-reporter-batch 'spec-done spec))
(expect (buttercup-output) :to-equal-including-properties
@@ -1201,7 +1210,7 @@ text properties using `ansi-color-apply'."
(buttercup-elapsed-time-string spec))))
(it "should color-print the description in red and say FAILED"
- (let ((buttercup-reporter-batch--failures nil))
+ (with-local-buttercup :color t
(buttercup-reporter-batch-color 'spec-started spec)
(buttercup-reporter-batch-color 'spec-done spec))
(expect (buttercup-output) :to-equal-including-properties
@@ -1217,7 +1226,7 @@ text properties using `ansi-color-apply'."
(buttercup--set-end-time spec))
(it "should output the failure-description"
- (let ((buttercup-reporter-batch--failures nil))
+ (with-local-buttercup :color nil
(buttercup-reporter-batch 'spec-started spec)
(buttercup-reporter-batch 'spec-done spec))
(expect (buttercup-output) :to-equal-including-properties
@@ -1225,7 +1234,7 @@ text properties using `ansi-color-apply'."
(buttercup-elapsed-time-string spec))))
(it "should color-print the description and failure-description in
yellow"
- (let ((buttercup-reporter-batch--failures nil))
+ (with-local-buttercup :color t
(buttercup-reporter-batch-color 'spec-started spec)
(buttercup-reporter-batch-color 'spec-done spec))
(expect (buttercup-output) :to-equal-including-properties
@@ -1240,19 +1249,23 @@ text properties using `ansi-color-apply'."
(describe "on the suite-done event"
(it "should emit a newline at the end of the top-level suite"
- (buttercup-reporter-batch 'suite-done parent-suite)
+ (with-local-buttercup :color nil
+ (buttercup-reporter-batch 'suite-done parent-suite))
(expect (buttercup-output) :to-equal-including-properties "\n"))
(it "should color-print a newline at the end of the top-level suite"
- (buttercup-reporter-batch-color 'suite-done parent-suite)
+ (with-local-buttercup :color t
+ (buttercup-reporter-batch-color 'suite-done parent-suite))
(expect (buttercup-output) :to-equal-including-properties "\n"))
(it "should not emit anything at the end of other suites"
- (buttercup-reporter-batch 'suite-done child-suite)
+ (with-local-buttercup :color nil
+ (buttercup-reporter-batch 'suite-done child-suite))
(expect (buttercup-output) :to-equal-including-properties ""))
(it "should not color-print anything at the end of other suites"
- (buttercup-reporter-batch-color 'suite-done child-suite)
+ (with-local-buttercup :color t
+ (buttercup-reporter-batch-color 'suite-done child-suite))
(expect (buttercup-output) :to-equal-including-properties "")))
(describe "on the buttercup-done event"
@@ -1267,13 +1280,13 @@ text properties using `ansi-color-apply'."
(it "should print a summary of run and failing specs"
(setq failed-specs 6)
- (let (buttercup-reporter-batch--failures)
+ (with-local-buttercup :color nil
(buttercup-reporter-batch 'buttercup-done nil))
(expect (buttercup-output) :to-match
"Ran 10 specs, 6 failed, in [0-9]+.[0-9]+[mu]?s.\n"))
(it "should color-print `0 failed' specs in green"
- (let (buttercup-reporter-batch--failures)
+ (with-local-buttercup :color t
(buttercup-reporter-batch-color 'buttercup-done nil))
(expect (buttercup-output) :to-match
"Ran 10 specs, 0 failed, in [0-9]+.[0-9]+[mu]?s.\n")
@@ -1283,7 +1296,7 @@ text properties using `ansi-color-apply'."
(it "should color-print `X failed' specs in red"
(setq failed-specs 6)
- (let (buttercup-reporter-batch--failures)
+ (with-local-buttercup :color t
(buttercup-reporter-batch-color 'buttercup-done nil))
(expect (buttercup-output) :to-match
"Ran 10 specs, 6 failed, in [0-9]+.[0-9]+[mu]?s.\n")
@@ -1293,15 +1306,15 @@ text properties using `ansi-color-apply'."
(it "should print a summary separating run and pending specs"
(setq pending-specs 3)
- (let (buttercup-reporter-batch--failures)
+ (with-local-buttercup :color nil
(buttercup-reporter-batch 'buttercup-done nil))
(expect (buttercup-output) :to-match
"Ran 7 out of 10 specs, 0 failed, in [0-9]+.[0-9]+[mu]?s.\n"))
(it "should color-print pending spec count in default color"
(setq pending-specs 3)
- (let (buttercup-reporter-batch--failures)
- (buttercup-reporter-batch 'buttercup-done nil))
+ (with-local-buttercup :color t
+ (buttercup-reporter-batch-color 'buttercup-done nil))
(expect (buttercup-output) :to-match
"Ran 7 out of 10 specs, 0 failed, in [0-9]+.[0-9]+[mu]?s.\n")
(expect (substring (buttercup-output)
@@ -1311,7 +1324,7 @@ text properties using `ansi-color-apply'."
(it "should not raise any error even if a spec failed"
(setf (buttercup-spec-status spec) 'failed)
- (let (buttercup-reporter-batch--failures)
+ (with-local-buttercup :color nil
(expect (buttercup-reporter-batch 'buttercup-done (list spec))
:not :to-throw)))
;; TODO: Backtrace tests
- [nongnu] elpa/buttercup b910b71 285/340: Extract buttercup--indented-description from the batch reporters, (continued)
- [nongnu] elpa/buttercup b910b71 285/340: Extract buttercup--indented-description from the batch reporters, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup e71a40f 287/340: Make sure carriage movement characters are not colorized, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup a22fc29 288/340: Bump version: 1.21 → 1.22, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup dde8651 290/340: Add new function buttercup--spec-mark-pending and use it, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup c59110b 291/340: test: Extend with-local-buttercup with some key arguments, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d443ecb 293/340: Clarify patterns in bin/buttercup, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 4d1acb8 294/340: test: Rewrite buttercup-run tests using spies, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 37223e4 296/340: actions: Run actions on push for all branches, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 50c7fc2 297/340: Switch to pcase in spec-done case of buttercup-reporter-batch, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup dd32cc7 298/340: test: Fix "should color-print pending spec count in default color", ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 0debeec 299/340: test: Use with-local-buttercup in more tests,
ELPA Syncer <=
- [nongnu] elpa/buttercup b3acf50 304/340: Lift spec-started handling into buttercup-reporter-batch, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 24a7bb9 306/340: Extract buttercup-reporter-batch--print-spec-done-line, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup c9addd5 307/340: Lift spec-done handling into buttercup-reporter-batch, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d6de872 309/340: Improve buttercup-reporter-batch--print-failed-spec-report, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 392b99c 310/340: Extend batch reporters to optionally print sparse reports, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup f6ab784 315/340: test: Test on GNU Emacs 27.1, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 4d974d2 319/340: Use correct function for --stale-file-error, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup a37d1a0 325/340: Fix compilation warning about undefined variable., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup b4e0986 333/340: Merge pull request #194 from doublep/eldev-doc, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 108d229 340/340: Fix property comparisons in unit tests., ELPA Syncer, 2021/12/16