]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/fixers/test_phpcbf_fixer_callback.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / test / fixers / test_phpcbf_fixer_callback.vader
1 Before:
2   Save g:ale_php_phpcbf_executable
3   Save g:ale_php_phpcbf_standard
4   Save g:ale_php_phpcbf_use_global
5
6   let g:ale_php_phpcbf_executable = 'phpcbf_test'
7   let g:ale_php_phpcbf_standard = ''
8   let g:ale_php_phpcbf_options = ''
9   let g:ale_php_phpcbf_use_global = 0
10
11   call ale#test#SetDirectory('/testplugin/test/fixers')
12
13 After:
14   Restore
15
16   call ale#test#RestoreDirectory()
17
18 Execute(project with phpcbf should use local by default):
19   call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php')
20
21   AssertEqual
22   \ ale#path#Simplify(g:dir . '/../test-files/php/project-with-phpcbf/vendor/bin/phpcbf'),
23   \ ale#fixers#phpcbf#GetExecutable(bufnr(''))
24
25 Execute(use-global should override local detection):
26   let g:ale_php_phpcbf_use_global = 1
27   call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php')
28
29   AssertEqual
30   \ 'phpcbf_test',
31   \ ale#fixers#phpcbf#GetExecutable(bufnr(''))
32
33 Execute(project without phpcbf should use global):
34   call ale#test#SetFilename('../test-files/php/project-without-phpcbf/foo/test.php')
35
36   AssertEqual
37   \ 'phpcbf_test',
38   \ ale#fixers#phpcbf#GetExecutable(bufnr(''))
39
40 Execute(The phpcbf callback should return the correct default values):
41   call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php')
42
43   AssertEqual
44   \ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/php/project-with-phpcbf/vendor/bin/phpcbf')) . ' --stdin-path=%s  -' },
45   \ ale#fixers#phpcbf#Fix(bufnr(''))
46
47 Execute(The phpcbf callback should include the phpcbf_standard option):
48   let g:ale_php_phpcbf_standard = 'phpcbf_ruleset.xml'
49   call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php')
50
51   AssertEqual
52   \ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/php/project-with-phpcbf/vendor/bin/phpcbf')) . ' --stdin-path=%s ' . '--standard=phpcbf_ruleset.xml' . ' -'},
53   \ ale#fixers#phpcbf#Fix(bufnr(''))
54
55 Execute(User provided options should be used):
56   let g:ale_php_phpcbf_options = '--my-user-provided-option my-value'
57   call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php')
58
59   AssertEqual
60   \ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/php/project-with-phpcbf/vendor/bin/phpcbf')) . ' --stdin-path=%s ' . ale#Pad('--my-user-provided-option my-value') . ' -'},
61   \ ale#fixers#phpcbf#Fix(bufnr(''))
62
63
64 Before:
65   Save g:ale_php_phpcbf_executable
66   Save g:ale_php_phpcbf_standard
67   Save g:ale_php_phpcbf_use_global
68
69   let g:ale_php_phpcbf_executable = 'phpcbf_test'
70   let g:ale_php_phpcbf_standard = ''
71   let g:ale_php_phpcbf_options = ''
72   let g:ale_php_phpcbf_use_global = 0
73
74   call ale#test#SetDirectory('/testplugin/test/fixers')
75
76 After:
77   Restore
78
79   call ale#test#RestoreDirectory()
80
81 Execute(project with phpcbf should use local by default):
82   call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php')
83
84   AssertEqual
85   \ ale#path#Simplify(g:dir . '/../test-files/php/project-with-phpcbf/vendor/bin/phpcbf'),
86   \ ale#fixers#phpcbf#GetExecutable(bufnr(''))
87
88 Execute(use-global should override local detection):
89   let g:ale_php_phpcbf_use_global = 1
90   call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php')
91
92   AssertEqual
93   \ 'phpcbf_test',
94   \ ale#fixers#phpcbf#GetExecutable(bufnr(''))
95
96 Execute(project without phpcbf should use global):
97   call ale#test#SetFilename('../test-files/php/project-without-phpcbf/foo/test.php')
98
99   AssertEqual
100   \ 'phpcbf_test',
101   \ ale#fixers#phpcbf#GetExecutable(bufnr(''))
102
103 Execute(The phpcbf callback should return the correct default values):
104   call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php')
105
106   AssertEqual
107   \ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/php/project-with-phpcbf/vendor/bin/phpcbf')) . ' --stdin-path=%s  -' },
108   \ ale#fixers#phpcbf#Fix(bufnr(''))
109
110 Execute(The phpcbf callback should include the phpcbf_standard option):
111   let g:ale_php_phpcbf_standard = 'phpcbf_ruleset.xml'
112   call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php')
113
114   AssertEqual
115   \ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/php/project-with-phpcbf/vendor/bin/phpcbf')) . ' --stdin-path=%s ' . '--standard=phpcbf_ruleset.xml' . ' -'},
116   \ ale#fixers#phpcbf#Fix(bufnr(''))
117