Commit 71c62ce4 authored by Sean Whitton's avatar Sean Whitton

Merge tag 'v1.15'

parents eb2f9dc2 4089d5f6
[bumpversion]
current_version = 1.14
current_version = 1.15
parse = (?P<major>\d+)\.(?P<minor>.*)
serialize = {major}.{minor}
files = buttercup.el buttercup-pkg.el
......
(define-package "buttercup" "1.14"
(define-package "buttercup" "1.15"
"Behavior-Driven Emacs Lisp Testing")
......@@ -2,7 +2,7 @@
;; Copyright (C) 2015-2017 Jorgen Schaefer <contact@jorgenschaefer.de>
;; Version: 1.14
;; Version: 1.15
;; Author: Jorgen Schaefer <contact@jorgenschaefer.de>
;; Package-Requires: ((emacs "24.3"))
;; URL: https://github.com/jorgenschaefer/emacs-buttercup
......@@ -1350,7 +1350,9 @@ A suite must be defined within a Markdown \"lisp\" code block."
(progn
(funcall buttercup-reporter 'buttercup-started buttercup-suites)
(mapc #'buttercup--run-suite buttercup-suites)
(funcall buttercup-reporter 'buttercup-done buttercup-suites))
(funcall buttercup-reporter 'buttercup-done buttercup-suites)
(when (> (buttercup-suites-total-specs-failed buttercup-suites) 0)
(error "")))
(error "No suites defined")))
(defvar buttercup--before-each nil
......@@ -1542,9 +1544,7 @@ EVENT and ARG are described in `buttercup-reporter'."
(buttercup--print "Ran %s specs, %s failed, in %.1f seconds.\n"
defined
failed
duration))
(when (> failed 0)
(error ""))))
duration))))
(_
(error "Unknown event %s" event)))))
......@@ -1628,9 +1628,7 @@ EVENT and ARG are described in `buttercup-reporter'."
", in %.1f seconds.\n")
defined
failed
duration))
(when (> failed 0)
(error ""))))
duration))))
(_
;; Fall through to buttercup-reporter-batch implementation.
......
......@@ -979,17 +979,49 @@
(it "should handle the end event"
(buttercup-reporter-batch 'buttercup-done nil))
(it "should raise an error if at least one spec failed"
(it "should not raise any error even if a spec failed"
(setf (buttercup-spec-status spec) 'failed)
(expect (buttercup-reporter-batch 'buttercup-done (list spec))
:to-throw)))
:not :to-throw)))
(describe "on an unknown event"
(it "should raise an error"
(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 raise an error if at least one spec failed"
(setf (buttercup-spec-status spec) 'failed)
(cl-letf (((symbol-function 'buttercup--run-suite) #'ignore))
(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))
(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))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment