File tree Expand file tree Collapse file tree 5 files changed +116
-0
lines changed Expand file tree Collapse file tree 5 files changed +116
-0
lines changed Original file line number Diff line number Diff line change
1
+ /vendor
Original file line number Diff line number Diff line change @@ -381,3 +381,12 @@ class Foo {
381
381
` <Leader>da ` will call your documentation plugin (by default Php Documentor for vim https://github.com/tobyS/pdv ) for every uncommented classes, methods, functions and properties.
382
382
383
383
384
+ ## Running tests
385
+
386
+ ```
387
+ bin/test
388
+ ```
389
+
390
+ ### How to write tests?
391
+
392
+ See https://github.com/junegunn/vader.vim
Original file line number Diff line number Diff line change
1
+ #! /bin/sh -eu
2
+
3
+ installVader ()
4
+ {
5
+ vaderdir=' vendor/vader.vim'
6
+ vaderCommit=' 6fff477431ac3191c69a3a5e5f187925466e275a'
7
+
8
+ test -d " $vaderdir " || {
9
+ {
10
+ git clone \
11
+ --branch=master \
12
+ --single-branch \
13
+ https://github.com/junegunn/vader.vim.git \
14
+ " $vaderdir "
15
+
16
+ git \
17
+ --work-tree=" $vaderdir " \
18
+ --git-dir=" $vaderdir /.git" \
19
+ reset --hard \
20
+ " $vaderCommit " --
21
+ } || {
22
+ rm -rf " $vaderdir "
23
+
24
+ exit 1
25
+ }
26
+ }
27
+ }
28
+
29
+ installVader
30
+
31
+ vim -esNu test/fixtures/vimrc -c ' Vader! test/*'
Original file line number Diff line number Diff line change
1
+ Given php (condition on if):
2
+ <?php
3
+
4
+ $sentence = 'Hello';
5
+
6
+ if ('foo' === $firstName) {
7
+ $sentence .= ' ' . $firstName;
8
+ }
9
+
10
+ Do (select the condition and extract variable):
11
+ /foo\<CR>
12
+ vi(
13
+ ;ev
14
+ firstNameIsValid\<CR>
15
+
16
+ Expect php (variable is extracted):
17
+ <?php
18
+
19
+ $sentence = 'Hello';
20
+
21
+ $firstNameIsValid = 'foo' === $firstName;
22
+
23
+ if ($firstNameIsValid) {
24
+ $sentence .= ' ' . $firstName;
25
+ }
26
+
27
+ Given php (condition on if and on function):
28
+ <?php
29
+
30
+ function prepareSentence()
31
+ {
32
+ $sentence = 'Hello';
33
+
34
+ if ('foo' === $firstName) {
35
+ $sentence .= ' ' . $firstName;
36
+ }
37
+
38
+ return $sentence;
39
+ }
40
+
41
+ Do (select the condition and extract variable):
42
+ /foo\<CR>
43
+ vi(
44
+ ;ev
45
+ firstNameIsValid\<CR>
46
+
47
+ Expect php (variable is extracted):
48
+ <?php
49
+
50
+ function prepareSentence()
51
+ {
52
+ $sentence = 'Hello';
53
+
54
+ $firstNameIsValid = 'foo' === $firstName;
55
+
56
+ if ($firstNameIsValid) {
57
+ $sentence .= ' ' . $firstName;
58
+ }
59
+
60
+ return $sentence;
61
+ }
Original file line number Diff line number Diff line change
1
+ " Setup a testing environment that is isolated from the other plugins.
2
+ "
3
+ filetype off
4
+
5
+ set rtp += vendor/vader.vim
6
+ set rtp += .
7
+ set rtp += after
8
+
9
+ filetype plugin on
10
+ filetype indent on
11
+
12
+ syntax enable
13
+
14
+ let mapleader = " ;"
You can’t perform that action at this time.
0 commit comments