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.
4 Save g:ale_set_quickfix
6 Save g:ale_set_highlights
9 let g:ale_buffer_info = {}
10 let g:ale_run_synchronously = 1
11 let g:ale_set_lists_synchronously = 1
12 let g:ale_set_signs = 0
13 let g:ale_set_quickfix = 0
14 let g:ale_set_loclist = 1
15 let g:ale_set_highlights = 0
16 let g:ale_echo_cursor = 0
18 function! TestCallback(buffer, output)
22 call ale#linter#Define('foobar', {
23 \ 'name': 'testlinter',
24 \ 'callback': 'TestCallback',
25 \ 'executable': has('win32') ? 'cmd' : 'echo',
26 \ 'command': has('win32') ? 'echo foo bar' : '/bin/sh -c ''echo foo bar''',
33 unlet! g:want_results_signaled
34 unlet! g:want_results_buffer_value
35 unlet! g:lint_pre_signaled
36 unlet! g:ale_run_synchronously
37 unlet! g:ale_set_lists_synchronously
39 delfunction TestCallback
47 call ale#linter#Reset()
48 call setloclist(0, [])
50 Given foobar (Some imaginary filetype):
51 Execute(StartChecking should mark a buffer as being actively checked):
52 Assert !ale#engine#IsCheckingBuffer(bufnr(''))
54 call ale#other_source#StartChecking(bufnr(''), 'other-source-linter')
56 Assert ale#engine#IsCheckingBuffer(bufnr(''))
58 Execute(ShowResults should make a buffer inactive):
59 call ale#other_source#StartChecking(bufnr(''), 'other-source-linter')
60 call ale#other_source#StartChecking(bufnr(''), 'second-other-source-linter')
62 call ale#other_source#ShowResults(bufnr(''), 'other-source-linter', [])
64 Assert ale#engine#IsCheckingBuffer(bufnr(''))
66 call ale#other_source#ShowResults(bufnr(''), 'second-other-source-linter', [])
68 Assert !ale#engine#IsCheckingBuffer(bufnr(''))
70 Execute(ShowResults should show results at any time):
71 call ale#other_source#ShowResults(bufnr(''), 'other-source-linter', [
72 \ {'text': 'xyz', 'lnum': 1},
89 \ ale#test#GetLoclistWithoutNewerKeys()
91 call ale#other_source#ShowResults(bufnr(''), 'other-source-linter', [])
93 AssertEqual [], ale#test#GetLoclistWithoutNewerKeys()
95 Execute(A regular lint cycle shouldn't clear results from other sources):
96 call ale#other_source#ShowResults(bufnr(''), 'other-source-linter', [
97 \ {'text': 'xyz', 'lnum': 1},
105 \ 'bufnr': bufnr(''),
115 \ ale#test#GetLoclistWithoutNewerKeys()
117 Execute(ALEWantResults should be signaled when a buffer is checked):
120 autocmd User ALEWantResults let g:want_results_signaled = 1
121 autocmd User ALELintPre let g:lint_pre_signaled = 1
124 " Even when all linters are disabled, we should send the signal.
125 let b:ale_linters = []
128 Assert get(g:, 'want_results_signaled')
129 Assert !get(g:, 'lint_pre_signaled')
131 Execute(ALEWantResults should set a variable indicating which buffer is being checked):
134 autocmd User ALEWantResults let g:want_results_buffer_value = g:ale_want_results_buffer
137 let b:ale_linters = []
140 AssertEqual bufnr(''), g:want_results_buffer_value
142 Execute(ALEWantResults should lead to an ALELintPre signal if another source responds):
145 autocmd User ALEWantResults call ale#other_source#StartChecking(bufnr(''), 'other-source-linter')
146 autocmd User ALELintPre let g:lint_pre_signaled = 1
149 " Even when all linters are disabled, we should send the signal.
150 let b:ale_linters = []
153 Assert get(g:, 'lint_pre_signaled')