[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/buttercup 2be9ad3 280/340: test: Add color tests for spec-
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/buttercup 2be9ad3 280/340: test: Add color tests for spec-done |
Date: |
Thu, 16 Dec 2021 14:59:50 -0500 (EST) |
branch: elpa/buttercup
commit 2be9ad32209176e82ad1a4cedac695a366db3258
Author: Ola Nilsson <ola.nilsson@gmail.com>
Commit: Ola Nilsson <ola.nilsson@gmail.com>
test: Add color tests for spec-done
Refactor the tests into new suites.
---
tests/test-buttercup.el | 91 +++++++++++++++++++++++++++++++++++--------------
1 file changed, 65 insertions(+), 26 deletions(-)
diff --git a/tests/test-buttercup.el b/tests/test-buttercup.el
index 9b5d5b3..e32e908 100644
--- a/tests/test-buttercup.el
+++ b/tests/test-buttercup.el
@@ -1139,34 +1139,73 @@ text properties using `ansi-color-apply'."
(expect (buttercup-output) :to-equal-including-properties " spec")))
(describe "on the spec-done event"
- (it "should print no status tag for a passed spec"
- (buttercup--set-start-time spec)
- (setf (buttercup-spec-failure-description spec) "DONTSHOW")
- (buttercup--set-end-time spec)
- (buttercup-reporter-batch 'spec-started spec)
- (buttercup-reporter-batch 'spec-done spec)
- (expect (buttercup-output) :to-equal
- (format " spec (%s)\n"
- (buttercup-elapsed-time-string spec))))
+ (describe "for a passed spec"
+ (before-each
+ (buttercup--set-start-time spec)
+ (setf (buttercup-spec-failure-description spec) "DONTSHOW")
+ (buttercup--set-end-time spec))
- (it "should say FAILED for a failed spec"
- (setf (buttercup-spec-status spec) 'failed)
- (let ((buttercup-reporter-batch--failures nil))
- (buttercup-reporter-batch 'spec-started spec)
- (buttercup-reporter-batch 'spec-done spec))
- (expect (buttercup-output) :to-equal
- (format " spec FAILED (%s)\n"
- (buttercup-elapsed-time-string spec))))
-
- (it "should output the failure-description for a pending spec"
- (setf (buttercup-spec-status spec) 'pending
- (buttercup-spec-failure-description spec) "DESCRIPTION")
- (let ((buttercup-reporter-batch--failures nil))
+ (it "should print no status tag"
(buttercup-reporter-batch 'spec-started spec)
- (buttercup-reporter-batch 'spec-done spec))
- (expect (buttercup-output) :to-equal
- (format " spec DESCRIPTION (%s)\n"
- (buttercup-elapsed-time-string 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)
+ (expect (buttercup-output) :to-equal-including-properties
+ (ansi-color-apply
+ (format "\e[32m spec\e[0m (%s)\n"
+ (buttercup-elapsed-time-string spec))))))
+
+ (describe "for a failed spec"
+ (before-each
+ (buttercup--set-start-time spec)
+ (setf (buttercup-spec-status spec) 'failed)
+ (buttercup--set-end-time spec))
+
+ (it "should say FAILED"
+ (let ((buttercup-reporter-batch--failures nil))
+ (buttercup-reporter-batch 'spec-started spec)
+ (buttercup-reporter-batch 'spec-done spec))
+ (expect (buttercup-output) :to-equal-including-properties
+ (format " spec FAILED (%s)\n"
+ (buttercup-elapsed-time-string spec))))
+
+ (it "should color-print the description in red and say FAILED"
+ (let ((buttercup-reporter-batch--failures nil))
+ (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[31m spec FAILED\e[0m (%s)\n"
+ (buttercup-elapsed-time-string spec))))))
+
+ (describe "for a pending spec"
+ (before-each
+ (buttercup--set-start-time spec)
+ (setf (buttercup-spec-status spec) 'pending
+ (buttercup-spec-failure-description spec) "DESCRIPTION")
+ (buttercup--set-end-time spec))
+
+ (it "should output the failure-description"
+ (let ((buttercup-reporter-batch--failures nil))
+ (buttercup-reporter-batch 'spec-started spec)
+ (buttercup-reporter-batch 'spec-done spec))
+ (expect (buttercup-output) :to-equal-including-properties
+ (format " spec DESCRIPTION (%s)\n"
+ (buttercup-elapsed-time-string spec))))
+
+ (it "should color-print the description and failure-description in
yellow"
+ (let ((buttercup-reporter-batch--failures nil))
+ (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[33m spec DESCRIPTION\e[0m (%s)\n"
+ (buttercup-elapsed-time-string spec))))))
(it "should throw an error for an unknown spec status"
(setf (buttercup-spec-status spec) 'unknown)
- [nongnu] elpa/buttercup 26e2ded 222/340: Rename some innacurate references to "fake" functions, (continued)
- [nongnu] elpa/buttercup 26e2ded 222/340: Rename some innacurate references to "fake" functions, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 9b87afc 234/340: Merge branch 'snogge/spy-context-tweaks', ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d8b596c 240/340: Merge branch 'doc-improve', ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 243b71f 245/340: Merge branch 'spy-scope-error', ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup f3c2b00 261/340: test: Move with-local-buttercup to top of file, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 0dbd474 263/340: Bump version: 1.20 → 1.21, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 1c9c82f 265/340: Fixed misspelling in the documentation, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 360953b 266/340: test: Only run tests found in the tests/ directory, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 25bc00d 273/340: test: Set up suite "The batch reporter" to use fake terminal, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 5c9f80d 279/340: test: Add color tests for buttercup-suite-started and -done, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 2be9ad3 280/340: test: Add color tests for spec-done,
ELPA Syncer <=
- [nongnu] elpa/buttercup 0e94f6e 303/340: Lift buttercup-done handling into buttercup-reporter-batch, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup f1f403b 308/340: Remove buttercup-reporter-batch-color, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup fce5fa5 313/340: Optionally fail when loading old elc files, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 6c3bb75 318/340: Accept a list of regexes in buttercup-mark-skipped, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 9dda405 320/340: Document use with Eldev, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 06201f2 335/340: Print :to-have-been-called-with args as sexp for consistency, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 459bffb 282/340: test: Add color tests for buttercup-done, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup a1c7bff 101/340: Do not ignore errors when after-each succeeds, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup b120003 108/340: Merge pull request #60 from howdoicomputer/feature/windows-bin-support, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 06c9699 104/340: Merge pull request #58 from Fuco1/to-equal-as-set, ELPA Syncer, 2021/12/16