branch: elpa/buttercup commit 9b230dceeb071f6f4d4c9b6e894df19c851b6649 Author: Ola Nilsson <ola.nils...@gmail.com> Commit: Ola Nilsson <ola.nils...@gmail.com>
Fix the "should print the elapsed time for all specs" test * Reset the spy calls for buttercup--print for each iteration. This is done before each spec, but in thie spec it has to be done in each loop iteration as well. * Set the failure-description to avoid 'nil' in buttercup--print arguments. * Only match at the end of the string, and with leading whitespace. * Allow for elapsed times with no decimals. --- tests/test-buttercup.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test-buttercup.el b/tests/test-buttercup.el index 5a660e6..bbcb1f3 100644 --- a/tests/test-buttercup.el +++ b/tests/test-buttercup.el @@ -951,7 +951,11 @@ (it "should print the elapsed time for all specs" (dolist (state '(pending failed passed)) - (setq spec (make-buttercup-spec :description "spec" :status state :parent child-suite)) + (spy-calls-reset 'buttercup--print) + (setq spec (make-buttercup-spec :description "spec" + :parent child-suite + :status state + :failure-description "")) (buttercup--set-start-time spec) (buttercup--set-end-time spec) (let ((buttercup-reporter-batch--failures nil)) @@ -960,7 +964,7 @@ (expect (mapconcat (apply-partially #'apply #'format) (spy-calls-all-args 'buttercup--print) "") - :to-match "([0-9]+\\.[0-9]+\\(h\\|m\\|m?s\\))")))) + :to-match " ([0-9]+\\(\\.[0-9]+\\)?\\(h\\|m\\|m?s\\))\n$")))) (describe "on the suite-done event" (it "should emit a newline at the end of the top-level suite"