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_set_lists_synchronously
8 let g:ale_buffer_info = {}
9 let g:ale_set_lists_synchronously = 1
11 function! TestCallback(buffer, output)
12 " Windows adds extra spaces to the text from echo.
16 \ 'text': substitute(a:output[0], ' *$', '', ''),
19 function! TestCallback2(buffer, output)
23 \ 'text': substitute(a:output[0], ' *$', '', ''),
27 " Running the command in another subshell seems to help here.
28 call ale#linter#Define('foobar', {
29 \ 'name': 'testlinter',
30 \ 'callback': 'TestCallback',
31 \ 'executable': has('win32') ? 'cmd' : 'echo',
32 \ 'command': has('win32') ? 'echo foo bar' : '/bin/sh -c ''echo foo bar''',
40 unlet! g:expected_results
42 delfunction TestCallback
43 delfunction TestCallback2
44 call ale#engine#Cleanup(bufnr(''))
45 call ale#linter#Reset()
47 Given foobar (Some imaginary filetype):
52 Execute(Linters should run with the default options):
53 AssertEqual 'foobar', &filetype
55 let g:expected_results = [{
56 \ 'bufnr': bufnr('%'),
67 " Try the test a few times over in NeoVim 0.3 or Windows or Vim 8.2,
68 " where tests fail randomly.
69 for g:i in range(has('nvim-0.3') || has('win32') || has('patch-8.2.2401') ? 5 : 1)
71 call ale#test#WaitForJobs(2000)
73 let g:results = ale#test#GetLoclistWithoutNewerKeys()
75 if g:results == g:expected_results
80 AssertEqual g:expected_results, g:results
82 Execute(Linters should run in PowerShell too):
86 AssertEqual 'foobar', &filetype
88 " Replace the callback to handle two lines.
89 function! TestCallback(buffer, output)
90 " Windows adds extra spaces to the text from echo.
95 \ 'text': substitute(a:output[0], ' *$', '', ''),
100 \ 'text': substitute(a:output[1], ' *$', '', ''),
105 " Recreate the command string to use &&, which PowerShell does not support.
106 call ale#linter#Reset()
107 call ale#linter#Define('foobar', {
108 \ 'name': 'testlinter',
109 \ 'callback': 'TestCallback',
110 \ 'executable': 'cmd',
111 \ 'command': 'echo foo && echo bar',
114 call ale#Queue(0, '')
115 call ale#test#WaitForJobs(4000)
119 \ 'bufnr': bufnr('%'),
130 \ 'bufnr': bufnr('%'),
140 \], ale#test#GetLoclistWithoutNewerKeys()