]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/fixers/test_fixjson_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:

Do not set EDITOR/VISUAL for shell
[etc/vim.git] / .vim / bundle / ale / test / fixers / test_fixjson_fixer_callback.vader
1 Before:
2   Save g:ale_json_fixjson_executable
3   Save g:ale_json_fixjson_options
4
5   let g:ale_json_fixjson_executable = '/path/to/fixjson'
6   let g:ale_json_fixjson_options = ''
7
8   call ale#test#SetDirectory('/testplugin/test/fixers')
9
10 After:
11   Restore
12
13 Execute(The fixjson callback should return the correct default command):
14   AssertEqual
15   \ {
16   \   'command': ale#Escape('/path/to/fixjson')
17   \     . ' --stdin-filename '
18   \     . ale#Escape(bufname(bufnr('')))
19   \ },
20   \ ale#fixers#fixjson#Fix(bufnr(''))
21
22 Execute(The fixjson callback should set the buffer name as file name):
23   call ale#test#SetFilename('../test-files/json/testfile.json')
24
25   AssertEqual
26   \ {
27   \   'command': ale#Escape('/path/to/fixjson')
28   \     . ' --stdin-filename '
29   \     . ale#Escape(bufname(bufnr('')))
30   \ },
31   \ ale#fixers#fixjson#Fix(bufnr(''))
32
33   AssertNotEqual
34   \ stridx(
35   \   ale#fixers#fixjson#Fix(bufnr('')).command,
36   \   'testfile.json',
37   \ ),
38   \ -1
39
40 Execute(The fixjson callback should include additional options):
41   let g:ale_json_fixjson_options = '-i 2'
42
43   AssertEqual
44   \ {
45   \   'command': ale#Escape('/path/to/fixjson')
46   \     . ' --stdin-filename '
47   \     . ale#Escape(bufname(bufnr('')))
48   \     . ' -i 2'
49   \ },
50   \ ale#fixers#fixjson#Fix(bufnr(''))