branch: elpa/buttercup commit fbb790b9013b368440048885a5787af59e9ce4e6 Author: Ola Nilsson <ola.nils...@gmail.com> Commit: Ola Nilsson <ola.nils...@gmail.com>
test: Add tests for buttercup-started and buttercup-reporter-batch-color Add a local matcher for equal-including-properties and use it for both buttercup-reporter-batch and buttercup-reporter-batch-color. --- tests/test-buttercup.el | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tests/test-buttercup.el b/tests/test-buttercup.el index 66061b6..1e058d2 100644 --- a/tests/test-buttercup.el +++ b/tests/test-buttercup.el @@ -1064,8 +1064,10 @@ text properties using `ansi-color-apply'." ;;;;;;;;;;;;; ;;; Reporters +(buttercup-define-matcher-for-binary-function + :to-equal-including-properties equal-including-properties) -(describe "The batch reporter" +(describe "The batch reporters" :var (print-buffer) (let (parent-suite child-suite spec) (before-each @@ -1099,13 +1101,24 @@ text properties using `ansi-color-apply'." (it "should print the number of specs" (let ((buttercup-reporter-batch--failures nil)) (buttercup-reporter-batch 'buttercup-started (list parent-suite))) - (expect (buttercup-output) :to-equal "Running 1 specs.\n\n")) + (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) + (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)) (buttercup-suite-add-child child-suite skipped) (buttercup-reporter-batch 'buttercup-started (list parent-suite))) - (expect (buttercup-output) :to-equal "Running 1 out of 2 specs.\n\n"))) + (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) + (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"