Commit 9a40f4af authored by Sean Whitton's avatar Sean Whitton

Merge tag 'v1.16'

parents 2a10b8ff 810fa6fb
[bumpversion]
current_version = 1.15
current_version = 1.16
parse = (?P<major>\d+)\.(?P<minor>.*)
serialize = {major}.{minor}
files = buttercup.el buttercup-pkg.el
......
(define-package "buttercup" "1.15"
(define-package "buttercup" "1.16"
"Behavior-Driven Emacs Lisp Testing")
......@@ -2,7 +2,7 @@
;; Copyright (C) 2015-2017 Jorgen Schaefer <contact@jorgenschaefer.de>
;; Version: 1.15
;; Version: 1.16
;; Author: Jorgen Schaefer <contact@jorgenschaefer.de>
;; Package-Requires: ((emacs "24.3"))
;; URL: https://github.com/jorgenschaefer/emacs-buttercup
......@@ -1248,9 +1248,6 @@ spec, and should be killed after running the spec.")
(buttercup-run))
(message "Suite executed successfully")))
(defvar buttercup-color t
"Whether to use colors in output.")
;;;###autoload
(defun buttercup-run-discover ()
"Discover and load test files, then run all defined suites.
......
......@@ -991,12 +991,8 @@
: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)
: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")
......@@ -1004,23 +1000,27 @@
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))
(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))
(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))
(cl-letf (((symbol-function 'buttercup--run-suite) #'ignore)
(buttercup-reporter 'reporter))
(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)))))
(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))))))
(describe "The `buttercup--print' function"
(before-each
......
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