Behaviour-driven design (BDD) for vim scripts
Vim script
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
autoload
doc
etc
macros
plugin
.gitignore
CHANGES.TXT
README
addon-info.json

README

This plugin provides a small set of commands to facilitate 
behaviour-driven design of vim plugins. It basically consists of two 
parts:

    spec   ... BDD-related commands
    should ... Convenience functions for testing

According to BDD theory, you are supposed to write a specification first 
and then make the code fulfill that specification. If you don't believe 
in BDD, you could also think of spec.vim as a more convenient approach 
to unit testing.

A example specification could look like this: >

    SpecBegin 'title': 'Foo', 'sfile': 'autoload/foo.vim'

    It should add numbers.
    Should be equal foo#Add(1, 2), 3
    
    It should not add values of other types.
    Should throw something 'foo#Add("1", 2)'

Spec knows how to rewrite certain rules in order to turn them into 
proper function call. Compare the following rules: >

    Should should#throw#Something('foo#Add([1], 2)')
    Should throw#Something('foo#Add([1], 2)')
    Should throw something('foo#Add({1:2}, 2)')
    Should throw something 'foo#Add({1:2}, 2)'

    Should !should#be#Equal(foo#Add(1, 2), 3)
    Should not be equal foo#Add(1, 2), 4

Specification scripts basically are normal vim scripts but must be run 
by the |:Spec| command. The |:SpecBegin| command also allows to define 
options sets against which the specification will be tested.

For an example specification see: ../spec/spec/spec.vim

CAVEAT: Please read at least the comments on |:Spec| and |:SpecBegin|.


-----------------------------------------------------------------------

Status:  Work in progress
Install: See http://github.com/tomtom/vimtlib/blob/master/INSTALL.TXT
See http://github.com/tomtom for related plugins.