Commit 28d86091 authored by Sean Whitton's avatar Sean Whitton

Merge tag 'v1.11'

parents 38878d6b 8d27bb99
[bumpversion]
current_version = 1.9
current_version = 1.11
parse = (?P<major>\d+)\.(?P<minor>.*)
serialize = {major}.{minor}
files = buttercup.el buttercup-pkg.el
......
#!/bin/bash
#!/usr/bin/env bash
if [ -n "$INSIDE_EMACS" ]
then
......
@bash %~dp0buttercup
@echo off
setlocal enabledelayedexpansion
if not [%inside_emacs%]==[] (
set emacs_bin=emacs
) else if not [%emacs%]==[] (
set emacs_bin=%emacs%
) else (
set emacs_bin=emacs
)
goto parse_args
:usage
echo %0 [OPTIONS] [DIRS]
echo.
echo Buttercup will search recursively in each of DIRS for test files (any
echo elisp file starting with "test-" or ending with "-test.el" or
echo ^"-tests.el"). It will load all of those files and then run the tests
echo defined in those files. If no directories are specified, buttercup
echo will search in the current directory.
echo.
echo Options can include the options described below, as well as the
echo standard Emacs options "--directory", "--funcall", "--load", "--eval",
echo and "--execute". These Emacs options should be used to ensure that any
echo Elisp files required for the tests can be found in Emacs' load path.
echo For package testing, "-L ." is commonly used. See "emacs --help" for
echo more information on Emacs options.
echo.
echo Buttercup options:
echo.
echo --pattern, -p PATTERN Only run tests with names matching PATTERN.
echo This option can be used multiple times, in
echo which case tests will be run if they match
echo any of the given patterns.
echo.
echo --no-color, -c Do not colorize test output.
echo.
echo --traceback STYLE When printing backtraces for errors that occur
echo during tests, print them in the chosen
echo STYLE. Available styles are "full", which
echo shows the full function call for each stack
echo frame on a single line, "crop", which
echo truncates each stack frame to 80 characters
echo ^(the default^), and "pretty", which uses
echo Emacs' pretty-printing facilities to print
echo each stack frame, and also annotates each
echo frame with a lambda or M to indicate whether
echo it is a normal function call or a
echo macro/special form.
exit /b
:parse_args
set emacs_args=
set buttercup_args=
:next_args
set current_arg=%1
set next_arg=%2
if not [%current_arg%]==[] (
if !current_arg!==-h (
goto usage
) else if !current_arg!==--help (
goto usage
) else if !current_arg!==-L (
set emacs_args=!emacs_args! !current_arg! !next_arg!
shift /1
shift /1
) else if !current_arg!==--directory (
set emacs_args=!emacs_args! !current_arg! !next_arg!
shift /1
shift /1
) else if !current_arg!==-f (
set emacs_args=!emacs_args! !current_arg! !next_arg!
shift /1
shift /1
) else if !current_arg!==--funcall (
set emacs_args=!emacs_args! !current_arg! !next_arg!
shift /1
shift /1
) else if !current_arg!==--l (
set emacs_args=!emacs_args! !current_arg! !next_arg!
shift /1
shift /1
) else if !current_arg!==--load (
set emacs_args=!emacs_args! !current_arg! !next_arg!
shift /1
shift /1
) else if !current_arg!==--eval (
set emacs_args=!emacs_args! !current_arg! !next_arg!
shift /1
shift /1
) else if !current_arg!==--execute (
set emacs_args=!emacs_args! !current_arg! !next_arg!
shift /1
shift /1
) else if !current_arg!==-p (
set buttercup_args=!buttercup_args! !current_arg! !next_arg!
shift /1
shift /1
) else if !current_arg!==--pattern (
set buttercup_args=!buttercup_args! !current_arg! !next_arg!
shift /1
shift /1
) else if !current_arg!==-c (
set buttercup_args=!buttercup_args! !current_arg!
shift /1
) else if !current_arg!==--no-color (
set buttercup_args=!buttercup_args! !current_arg!
shift /1
) else if !current_arg!==--traceback (
set buttercup_args=!buttercup_args! !current_arg! !next_arg!
shift /1
shift /1
) else (
set buttercup_args=!buttercup_args! !current_arg!
shift /1
)
goto next_args
)
%emacs_bin% -batch %emacs_args% -l buttercup -f buttercup-run-discover %buttercup_args%
(define-package "buttercup" "1.9"
(define-package "buttercup" "1.11"
"Behavior-Driven Emacs Lisp Testing")
This diff is collapsed.
......@@ -15,6 +15,12 @@
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; Define test-suites to test buttercup itself. This test suite
;; should pass for all Emacs versions defined in the .travis.yml file
;; in the project directory root.
;;; Code:
(require 'buttercup)
......@@ -23,7 +29,7 @@
(require 'cl-lib)
(defun make-list-of-closures (items)
"For each element of ITEMS, return a closure that returns it."
"For each element of ITEMS, return a closure returning it."
(mapcar (lambda (item)
(lambda () item))
items))
......@@ -277,7 +283,7 @@
"su1 su2"))))
(describe "The `buttercup-spec-full-name' function"
(let (su1 su2 sp1)
(let (su1 su2 sp1 sp2)
(before-each
(setq su1 (make-buttercup-suite :description "su1")
su2 (make-buttercup-suite :description "su2")
......@@ -372,7 +378,7 @@
(it "should add a spec to the current suite"
(let ((buttercup--current-suite (make-buttercup-suite)))
(buttercup-it "the test spec"
(lambda () 23))
(lambda () 23))
(let ((spec (car (buttercup-suite-children buttercup--current-suite))))
(expect (buttercup-spec-description spec)
:to-equal
......@@ -461,7 +467,7 @@
(it "should be a no-op"
(expect (buttercup-xdescribe
"bla bla"
(lambda () (error "should not happen")))
(lambda () (error "Should not happen")))
:not :to-throw))
(it "should add a pending suite"
......@@ -489,13 +495,13 @@
(let ((buttercup--current-suite (make-buttercup-suite)))
(buttercup-xit
"bla bla"
(lambda () (error "should not happen")))))
(lambda () (error "Should not happen")))))
:not :to-throw)
(it "should add a function that raises a pending signal"
(let ((buttercup--current-suite (make-buttercup-suite)))
(buttercup-xit "bla bla" (lambda ()
(error "should not happen")))
(error "Should not happen")))
(expect (funcall
(buttercup-spec-function
(car (buttercup-suite-children buttercup--current-suite))))
......@@ -709,45 +715,45 @@
:to-equal
23))
(it "works with strings"
(spy-on 'test-function :and-return-value "return value")
(expect (test-function 2 3)
:to-equal
"return value"))
(it "works with vectors"
(spy-on 'test-function :and-return-value [1 2 3 4])
(expect (test-function 2 3)
:to-equal
[1 2 3 4]))
(it "works with symbols"
(spy-on 'test-function :and-return-value 'symbol)
(expect (test-function 2 3)
:to-equal
'symbol))
(it "works with conses"
(spy-on 'test-function :and-return-value '(1 . 2))
(expect (test-function 2 3)
:to-equal
(cons 1 2)))
(it "works with lists"
(spy-on 'test-function :and-return-value '(1 2 3))
(expect (test-function 2 3)
:to-equal
'(1 2 3)))
(it "works with alists"
(spy-on 'test-function :and-return-value '((first . 1)
(second . 2)
(third . 3)))
(expect (test-function 2 3)
:to-equal
'((first . 1)
(second . 2)
(third . 3)))))
(it "works with strings"
(spy-on 'test-function :and-return-value "return value")
(expect (test-function 2 3)
:to-equal
"return value"))
(it "works with vectors"
(spy-on 'test-function :and-return-value [1 2 3 4])
(expect (test-function 2 3)
:to-equal
[1 2 3 4]))
(it "works with symbols"
(spy-on 'test-function :and-return-value 'symbol)
(expect (test-function 2 3)
:to-equal
'symbol))
(it "works with conses"
(spy-on 'test-function :and-return-value '(1 . 2))
(expect (test-function 2 3)
:to-equal
(cons 1 2)))
(it "works with lists"
(spy-on 'test-function :and-return-value '(1 2 3))
(expect (test-function 2 3)
:to-equal
'(1 2 3)))
(it "works with alists"
(spy-on 'test-function :and-return-value '((first . 1)
(second . 2)
(third . 3)))
(expect (test-function 2 3)
:to-equal
'((first . 1)
(second . 2)
(third . 3)))))
(describe ":and-call-fake keyword functionality"
(before-each
......@@ -953,3 +959,7 @@
(expect specs :to-be-truthy)
(expect (length (cdr specs)) :to-equal 1)
(expect (cl-caadr specs) :to-equal "should fontify special keywords")))))
(provide 'test-buttercup)
;;; test-buttercup.el ends here
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