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.
3 Save g:ale_run_synchronously
4 Save g:ale_set_lists_synchronously
8 let g:ale_buffer_info = {}
9 let g:ale_run_synchronously = 1
10 let g:ale_set_lists_synchronously = 1
12 function! TestCallback(buffer, output)
13 " Windows adds extra spaces to the text from echo.
17 \ 'text': 'testlinter1',
20 function! TestCallback2(buffer, output)
21 " Windows adds extra spaces to the text from echo.
25 \ 'text': 'testlinter2',
28 function! TestCallback3(buffer, output)
29 " Windows adds extra spaces to the text from echo.
33 \ 'text': 'testlinter3',
37 " These two linters computer their lint_file values after running commands.
38 call ale#linter#Define('foobar', {
39 \ 'name': 'testlinter1',
40 \ 'callback': 'TestCallback',
41 \ 'executable': has('win32') ? 'cmd' : 'echo',
42 \ 'command': has('win32') ? 'echo foo bar' : '/bin/sh -c ''echo foo bar''',
43 \ 'lint_file': {b -> ale#command#Run(b, 'echo', {-> 1})},
45 call ale#linter#Define('foobar', {
46 \ 'name': 'testlinter2',
47 \ 'callback': 'TestCallback2',
48 \ 'executable': has('win32') ? 'cmd' : 'echo',
49 \ 'command': has('win32') ? 'echo foo bar' : '/bin/sh -c ''echo foo bar''',
50 \ 'lint_file': {b -> ale#command#Run(b, 'echo', {-> ale#command#Run(b, 'echo', {-> 1})})},
52 " This one directly computes the result.
53 call ale#linter#Define('foobar', {
54 \ 'name': 'testlinter3',
55 \ 'callback': 'TestCallback3',
56 \ 'executable': has('win32') ? 'cmd' : 'echo',
57 \ 'command': has('win32') ? 'echo foo bar' : '/bin/sh -c ''echo foo bar''',
58 \ 'lint_file': {b -> 1},
61 let g:filename = tempname()
62 call writefile([], g:filename)
63 call ale#test#SetFilename(g:filename)
66 delfunction TestCallback
68 call ale#engine#Cleanup(bufnr(''))
70 call ale#linter#Reset()
72 " Items and markers, etc.
73 call setloclist(0, [])
77 if filereadable(g:filename)
78 call delete(g:filename)
83 Given foobar(A file with some lines):
88 Execute(lint_file results where the result is eventually computed should be run):
89 call ale#Queue(0, 'lint_file')
90 call ale#test#FlushJobs()
95 \ 'bufnr': bufnr('%'),
99 \ 'text': 'testlinter2',
106 \ 'bufnr': bufnr('%'),
110 \ 'text': 'testlinter1',
117 \ 'bufnr': bufnr('%'),
121 \ 'text': 'testlinter3',
128 \ ale#test#GetLoclistWithoutNewerKeys()
130 Execute(Linters where lint_file eventually evaluates to 1 shouldn't be run if we don't want to run them):
131 call ale#Queue(0, '')
132 call ale#test#FlushJobs()
134 AssertEqual [], ale#test#GetLoclistWithoutNewerKeys()
136 Execute(Keeping computed lint_file jobs running should work):
137 AssertEqual 'testlinter2', ale#linter#Get('foobar')[1].name
139 call ale#engine#InitBufferInfo(bufnr(''))
141 call ale#engine#MarkLinterActive(
142 \ g:ale_buffer_info[bufnr('')],
143 \ ale#linter#Get('foobar')[1]
145 call ale#engine#RunLinters(bufnr(''), ale#linter#Get('foobar'), 0)
147 Assert !empty(g:ale_buffer_info[bufnr('')].active_linter_list),
148 \ 'The active linter list was empty'
149 Assert ale#engine#IsCheckingBuffer(bufnr('')),
150 \ 'The IsCheckingBuffer function returned 0'