[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/buttercup a55a638 064/340: More and better tests for the b
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/buttercup a55a638 064/340: More and better tests for the batch reporter. |
Date: |
Thu, 16 Dec 2021 14:59:05 -0500 (EST) |
branch: elpa/buttercup
commit a55a6386c5ac75d5055a9195813760491323e655
Author: Jorgen Schaefer <contact@jorgenschaefer.de>
Commit: Jorgen Schaefer <contact@jorgenschaefer.de>
More and better tests for the batch reporter.
---
buttercup-test.el | 96 ++++++++++++++++++++++++++++++++++++++++---------------
1 file changed, 70 insertions(+), 26 deletions(-)
diff --git a/buttercup-test.el b/buttercup-test.el
index ec5068e..735bd9e 100644
--- a/buttercup-test.el
+++ b/buttercup-test.el
@@ -548,42 +548,86 @@
(buttercup-suite-add-child child-suite spec)
(spy-on 'buttercup--print))
- (it "should handle the start event"
- (buttercup-reporter-batch 'buttercup-started nil))
+ (describe "on the buttercup-started event"
+ (it "should emit the number of specs"
+ (let ((buttercup-reporter-batch--start-time nil))
+ (buttercup-reporter-batch 'buttercup-started (list parent-suite)))
- (it "should emit an indented suite description on suite start"
- (buttercup-reporter-batch 'suite-started child-suite)
+ (expect 'buttercup--print
+ :to-have-been-called-with
+ "Running %s specs.\n\n"
+ 1)))
- (expect 'buttercup--print
- :to-have-been-called-with
- "%s%s\n"
- " "
- "child-suite"))
+ (describe "on the suite-started event"
+ (it "should emit an indented suite description"
+ (buttercup-reporter-batch 'suite-started child-suite)
- (it "should emit an indented spec description on spec start"
- (buttercup-reporter-batch 'spec-started spec)
+ (expect 'buttercup--print
+ :to-have-been-called-with
+ "%s%s\n"
+ " "
+ "child-suite")))
- (expect 'buttercup--print
- :to-have-been-called-with
- "%s%s"
- " "
- "spec"))
+ (describe "on the spec-started event"
+ (it "should emit an indented spec description"
+ (buttercup-reporter-batch 'spec-started spec)
- (it "should handle the spec done event"
- (buttercup-reporter-batch 'spec-done spec))
+ (expect 'buttercup--print
+ :to-have-been-called-with
+ "%s%s"
+ " "
+ "spec")))
- (it "should emit a newline at the end of the top-level suite"
- (buttercup-reporter-batch 'suite-done parent-suite)
+ (describe "on the spec-done event"
+ (it "should simply emit a newline for a passed spec"
+ (buttercup-reporter-batch 'spec-done spec)
- (expect 'buttercup--print :to-have-been-called-with "\n"))
+ (expect 'buttercup--print :to-have-been-called-with "\n"))
- (it "should not emit anything at the end of other suites"
- (buttercup-reporter-batch 'suite-done child-suite)
+ (it "should say FAILED for a failed spec"
+ (setf (buttercup-spec-status spec) 'failed)
- (expect 'buttercup--print :not :to-have-been-called))
+ (let ((buttercup-reporter-batch--failures nil))
+ (buttercup-reporter-batch 'spec-done spec))
- (it "should handle the end event"
- (buttercup-reporter-batch 'buttercup-done nil))))
+ (expect 'buttercup--print :to-have-been-called-with " FAILED\n"))
+
+ (it "should throw an error for an unknown spec status"
+ (setf (buttercup-spec-status spec) 'unknown)
+
+ (expect (lambda ()
+ (buttercup-reporter-batch 'spec-done spec))
+ :to-throw)))
+
+ (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)
+
+ (expect 'buttercup--print :to-have-been-called-with "\n"))
+
+ (it "should not emit anything at the end of other suites"
+ (buttercup-reporter-batch 'suite-done child-suite)
+
+ (expect 'buttercup--print :not :to-have-been-called)))
+
+ (describe "on the buttercup-done event"
+ ;; This is a lie. It should do a ton more stuff. We should test
+ ;; that, too.
+ (it "should handle the end event"
+ (buttercup-reporter-batch 'buttercup-done nil))
+
+ (it "should raise an error if at least one spec failed"
+ (setf (buttercup-spec-status spec) 'failed)
+
+ (expect (lambda ()
+ (buttercup-reporter-batch 'buttercup-done (list spec)))
+ :to-throw)))
+
+ (describe "on an unknown event"
+ (it "should raise an error"
+ (expect (lambda ()
+ (buttercup-reporter-batch 'unknown-event nil))
+ :to-throw)))))
;;;;;;;;;;;;;
;;; Utilities
- [nongnu] elpa/buttercup 0f3eb63 078/340: Show actual function arguments when a spy fails., (continued)
- [nongnu] elpa/buttercup 0f3eb63 078/340: Show actual function arguments when a spy fails., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 357e73b 085/340: Remove debug message, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 68692d9 113/340: Update Travis configuration instructions, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 54696b0 124/340: Merge pull request #78 from Fuco1/feature/buttercup-minor-mode, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 77f0c74 122/340: Fix :to-have-same-items-as (fix #80), ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 20ec520 145/340: Rename functions and arguments for closure manipulation, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 5d1f338 146/340: Move let-binding outside loop for efficiency, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 7fa79c4 048/340: Expand and improve the package commentary., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 4f68f0b 059/340: The buttercup-spec-full-name function., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup ef7b730 063/340: Various improvements of the batch reporter., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup a55a638 064/340: More and better tests for the batch reporter.,
ELPA Syncer <=
- [nongnu] elpa/buttercup c7df9f6 069/340: Add 24.5., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 0c5cc32 057/340: The buttercup-suites-total-specs-defined function., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup ea8effb 095/340: Add the :var argument to describe, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 23472e9 099/340: :to-match: Show correct error messages, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup cc52444 107/340: feature/windows-bin-support: support for windows, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 3ef90b4 100/340: :to-match: Don't switch t/nil!, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup ab2a558 111/340: Add projectile integration info to Readme, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 0124cc4 129/340: Signal an error when ":to-throw" is used on a non-function (#97), ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 31e765b 142/340: Do not suppress errors while loading test files, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup bc13b53 183/340: Merge pull request #133 from snogge/fix-specs-in-pending-suites, ELPA Syncer, 2021/12/16