]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/fixers/test_gopls_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_gopls_fixer_callback.vader
1 Before:
2   Save g:ale_go_gopls_fix_executable
3   Save g:ale_go_gopls_fix_options
4   Save g:ale_go_go111module
5
6   " Use an invalid global executable, so we don't match it.
7   let g:ale_go_gopls_fix_executable = 'xxxinvalid'
8   let g:ale_go_gopls_fix_options = ''
9
10   call ale#test#SetDirectory('/testplugin/test/fixers')
11   call ale#test#SetFilename('../test-files/go/testfile.go')
12
13 After:
14   Restore
15
16   unlet! b:ale_go_go111module
17
18   call ale#test#RestoreDirectory()
19
20 Execute(The gopls callback should return 0 when the executable isn't executable):
21   AssertEqual
22   \ 0,
23   \ ale#fixers#gopls#Fix(bufnr(''))
24
25 Execute(The gopls callback should the command when the executable test passes):
26   let g:ale_go_gopls_fix_executable = has('win32') ? 'cmd' : 'echo'
27
28   AssertEqual
29   \ {
30   \   'read_temporary_file': 1,
31   \   'command': ale#Escape(g:ale_go_gopls_fix_executable) . ' format -l -w %t'
32   \ },
33   \ ale#fixers#gopls#Fix(bufnr(''))
34
35 Execute(The gopls callback should include extra options):
36   let g:ale_go_gopls_fix_executable = has('win32') ? 'cmd' : 'echo'
37   let g:ale_go_gopls_fix_options = '--xxx'
38
39   AssertEqual
40   \ {
41   \   'read_temporary_file': 1,
42   \   'command': ale#Escape(g:ale_go_gopls_fix_executable) . ' format --xxx -l -w %t'
43   \ },
44   \ ale#fixers#gopls#Fix(bufnr(''))
45
46 Execute(The gopls callback should support Go environment variables):
47   let g:ale_go_gopls_fix_executable = has('win32') ? 'cmd' : 'echo'
48   let g:ale_go_go111module = 'on'
49
50   AssertEqual
51   \ {
52   \   'read_temporary_file': 1,
53   \   'command': ale#Env('GO111MODULE', 'on')
54   \     . ale#Escape(g:ale_go_gopls_fix_executable)
55   \     . ' format -l -w %t'
56   \ },
57   \ ale#fixers#gopls#Fix(bufnr(''))