diff options
author | Ola Nilsson <ola.nilsson@gmail.com> | 2018-10-10 00:09:12 +0200 |
---|---|---|
committer | Jorgen Schäfer <Jorgen.Schaefer@gmail.com> | 2018-10-12 09:40:00 +0200 |
commit | 7cea4c6e2b4757c688e0d32c99b5389147102633 (patch) | |
tree | 319bd450c1d75172f58af016362584c3589e5678 | |
parent | a394fea9888b8491567a641de82b35679e6032e5 (diff) |
Test buttercup-run
-rw-r--r-- | tests/test-buttercup.el | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test-buttercup.el b/tests/test-buttercup.el index 39cc272..40aeee9 100644 --- a/tests/test-buttercup.el +++ b/tests/test-buttercup.el @@ -990,6 +990,34 @@ (expect (buttercup-reporter-batch 'unknown-event nil) :to-throw))))) +(describe "The `buttercup-run' function" + (let* ((reporter (lambda (event arg) (ignore event arg))) + (runner (lambda (suite) (ignore suite))) + (buttercup-reporter 'reporter) + buttercup-suites + parent-suite child-suite spec) + (ignore reporter runner) + (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) + (spy-on 'runner)) + (it "should call the reporter twice with events buttercup-started and -done" + (cl-letf (((symbol-function 'buttercup--run-suite) #'ignore)) + (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-letf (((symbol-function 'buttercup--run-suite) #'runner) + (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 (spy-on 'send-string-to-terminal)) |