-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
48 lines (32 loc) · 1.65 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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.