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.
1 Given foobar (Some imaginary filetype):
8 Save g:ale_run_synchronously
9 Save g:ale_set_highlights
10 Save g:ale_set_loclist
11 Save g:ale_set_quickfix
13 Save g:ale_command_wrapper
14 Save g:ale_use_neovim_diagnostics_api
16 let g:ale_command_wrapper = ''
17 let g:ale_buffer_info = {}
18 let g:ale_run_synchronously = 1
19 unlet! g:ale_run_synchronously_callbacks
20 let g:ale_set_signs = 1
21 " Disable features we don't need for these tests.
22 let g:ale_set_quickfix = 0
23 let g:ale_set_loclist = 0
24 let g:ale_set_highlights = 0
25 let g:ale_echo_cursor = 0
26 let g:ale_use_neovim_diagnostics_api = 0
30 function! TestCallback(buffer, output)
32 \ {'lnum': 1, 'text': 'foo', 'type': 'W'},
33 \ {'lnum': 2, 'text': 'foo', 'type': 'E'},
37 function! CollectSigns()
39 if has('nvim-0.4.2') || has('patch-8.1.614')
40 silent exec 'sign place group=ale_signs'
42 silent exec 'sign place'
46 let l:actual_sign_list = []
48 for l:line in split(l:output, "\n")
49 let l:match = matchlist(l:line, ale#sign#ParsePattern())
52 call add(l:actual_sign_list, [l:match[1], l:match[3]])
56 return l:actual_sign_list
59 call ale#linter#Define('foobar', {
60 \ 'name': 'testlinter',
61 \ 'callback': 'TestCallback',
62 \ 'executable': has('win32') ? 'cmd' : 'echo',
63 \ 'command': has('win32') ? 'echo foo bar' : '/bin/sh -c ''echo foo bar''',
67 delfunction TestCallback
68 delfunction CollectSigns
70 unlet! g:ale_run_synchronously_callbacks
72 call ale#linter#Reset()
74 Execute(The signs should be updated after linting is done):
76 call ale#test#FlushJobs()
78 AssertEqual [['1', 'ALEWarningSign'], ['2', 'ALEErrorSign']], CollectSigns()
80 Execute(Signs should not be set when diagnostics API integration is enabled):
81 let g:ale_use_neovim_diagnostics_api = 1
83 call ale#test#FlushJobs()
85 AssertEqual [], CollectSigns()