[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/buttercup 9d172a7 205/340: Merge pull request #145 from sn
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/buttercup 9d172a7 205/340: Merge pull request #145 from snogge/test-fixes |
Date: |
Thu, 16 Dec 2021 14:59:35 -0500 (EST) |
branch: elpa/buttercup
commit 9d172a74373916f571f6fe3292bdc66cd3f28779
Merge: debe7cc 159fe3c
Author: Ola Nilsson <ola.nilsson@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #145 from snogge/test-fixes
Fix the tests that were reported as problematic in #144
---
tests/test-buttercup.el | 65 ++++++++++++++++++++++++++++---------------------
1 file changed, 37 insertions(+), 28 deletions(-)
diff --git a/tests/test-buttercup.el b/tests/test-buttercup.el
index b78c104..06dcce4 100644
--- a/tests/test-buttercup.el
+++ b/tests/test-buttercup.el
@@ -956,7 +956,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))
@@ -965,7 +969,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"
@@ -996,36 +1000,41 @@
:to-throw)))))
(describe "The `buttercup-run' function"
- :var (buttercup-suites parent-suite child-suite spec)
- (cl-flet (((reporter (event arg) (ignore event arg))))
- (before-each
- (setq parent-suite (make-buttercup-suite :description "parent-suite")
- child-suite (make-buttercup-suite :description "child-suite")
- spec (make-buttercup-spec :description "spec")
- buttercup-suites (list parent-suite))
- (buttercup-suite-add-child parent-suite child-suite)
- (buttercup-suite-add-child child-suite spec)
- (spy-on 'reporter))
- (it "should raise an error if at least one spec failed"
- (setf (buttercup-spec-status spec) 'failed)
- (cl-letf (((symbol-function 'buttercup--run-suite) #'ignore)
- (buttercup-reporter 'reporter))
- (expect (buttercup-run) :to-throw)))
- (it "should call the reporter twice with events buttercup-started and
-done"
- (cl-letf (((symbol-function 'buttercup--run-suite) #'ignore)
- (buttercup-reporter 'reporter))
+ :var (parent-suite child-suite spec reporter)
+ (before-each
+ (ignore reporter)
+ (setf (symbol-function 'reporter) (lambda (event arg) (ignore event arg)))
+ (setq parent-suite (make-buttercup-suite :description "parent-suite")
+ child-suite (make-buttercup-suite :description "child-suite")
+ spec (make-buttercup-spec :description "spec"))
+ (buttercup-suite-add-child parent-suite child-suite)
+ (buttercup-suite-add-child child-suite spec)
+ (spy-on 'reporter))
+ (it "should raise an error if at least one spec failed"
+ (setf (buttercup-spec-status spec) 'failed)
+ (cl-letf (((symbol-function 'buttercup--run-suite) #'ignore)
+ (buttercup-reporter 'reporter))
+ (let ((buttercup-suites (list parent-suite)))
+ (expect (buttercup-run) :to-throw))))
+ (it "should call the reporter twice with events buttercup-started and -done"
+ (cl-letf (((symbol-function 'buttercup--run-suite) #'ignore)
+ (buttercup-reporter 'reporter))
+ (let ((buttercup-suites (list parent-suite)))
(expect (buttercup-run) :not :to-throw)
(expect 'reporter :to-have-been-called-times 2)
(expect 'reporter :to-have-been-called-with 'buttercup-started
buttercup-suites)
(expect 'reporter :to-have-been-called-with 'buttercup-done
buttercup-suites)))
- (it "should call `buttercup--run-suite once per suite"
- (cl-flet (((runner (suite) (ignore suite))))
- (spy-on 'runner)
- (cl-letf (((symbol-function 'buttercup--run-suite) #'runner)
- (buttercup-reporter 'reporter)
- (buttercup-suites (make-list 5 parent-suite)))
- (expect (buttercup-run) :not :to-throw)
- (expect 'runner :to-have-been-called-times 5))))))
+ )
+ (it "should call `buttercup--run-suite once per suite"
+ (let ((buttercup-suites (list parent-suite)) runner)
+ (ignore runner)
+ (setf (symbol-function 'runner) (lambda (suite) (ignore suite)))
+ (spy-on 'runner)
+ (cl-letf (((symbol-function 'buttercup--run-suite) #'runner)
+ (buttercup-reporter 'reporter)
+ (buttercup-suites (make-list 5 parent-suite)))
+ (expect (buttercup-run) :not :to-throw)
+ (expect 'runner :to-have-been-called-times 5)))))
(describe "The `buttercup--print' function"
(before-each
- [nongnu] elpa/buttercup 61ebe91 171/340: Update README.md, (continued)
- [nongnu] elpa/buttercup 61ebe91 171/340: Update README.md, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 39d625c 173/340: Bump version: 1.11 → 1.12, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 6330610 176/340: Add more markdown running functions, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 3d3aff9 178/340: Set file local code-style variables in test-buttercup.el, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 553529f 181/340: Remove obsolete buttercup-xdescribe, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 5821cd0 184/340: Merge pull request #131 from snogge/markdown, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup a394fea 191/340: Bump version: 1.13 → 1.14, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 7cea4c6 192/340: Test buttercup-run, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup b410c78 193/340: Separate return code from reporter, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 9b230dc 202/340: Fix the "should print the elapsed time for all specs" test, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 9d172a7 205/340: Merge pull request #145 from snogge/test-fixes,
ELPA Syncer <=
- [nongnu] elpa/buttercup c100fad 210/340: Implement buttercup-suppress-warning-capture, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup c994aea 212/340: Add LICENSE file., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d9ce620 213/340: Merge branch 'license-file' into master, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 49f01fc 219/340: Merge branch 'master' into test-emacs-26.3, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 25462dd 223/340: Record calls to spied-on functions that throw errors, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup bf48137 224/340: Add some tests for error-call recording, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup fc19598 225/340: Add examples for checking return value and thrown signal of a spy, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 6590360 226/340: Fix a few typos and other small errors, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 8a28489 230/340: Bump version: 1.18 → 1.19, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 0e40587 231/340: Tweak the spy-contexts to be more backward compatible, ELPA Syncer, 2021/12/16