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.
13 Execute (PreProcess should throw when the linter object is not a Dictionary):
14 AssertThrows call ale#linter#PreProcess('testft', '')
15 AssertEqual 'The linter object must be a Dictionary', g:vader_exception
17 Execute (PreProcess should throw when there is no name):
18 AssertThrows call ale#linter#PreProcess('testft', {
19 \ 'callback': 'SomeFunction',
20 \ 'executable': 'echo',
23 AssertEqual '`name` must be defined to name the linter', g:vader_exception
25 Execute (PreProcess should throw when there is no callback):
26 AssertThrows call ale#linter#PreProcess('testft', {
28 \ 'executable': 'echo',
31 AssertEqual '`callback` must be defined with a callback to accept output', g:vader_exception
33 Execute (PreProcess should throw when then callback is not a function):
34 AssertThrows call ale#linter#PreProcess('testft', {
37 \ 'executable': 'echo',
40 AssertEqual '`callback` must be defined with a callback to accept output', g:vader_exception
42 Execute (PreProcess should throw when there is no executable):
43 AssertThrows call ale#linter#PreProcess('testft', {
45 \ 'callback': 'SomeFunction',
48 AssertEqual '`executable` must be defined', g:vader_exception
50 Execute (PreProcess should throw when executable is not a string):
51 AssertThrows call ale#linter#PreProcess('testft', {
53 \ 'callback': 'SomeFunction',
57 AssertEqual '`executable` must be a String or Function if defined', g:vader_exception
59 Execute (PreProcess should allow executable to be a callback):
60 call ale#linter#PreProcess('testft', {
62 \ 'callback': 'SomeFunction',
63 \ 'executable': function('type'),
67 Execute (PreProcess should throw when there is no command):
68 AssertThrows call ale#linter#PreProcess('testft', {
70 \ 'callback': 'SomeFunction',
71 \ 'executable': 'echo',
73 AssertEqual '`command` must be defined', g:vader_exception
75 Execute (PreProcess should throw when command is not a string):
76 AssertThrows call ale#linter#PreProcess('testft', {
78 \ 'callback': 'SomeFunction',
79 \ 'executable': 'echo',
82 AssertEqual '`command` must be a String or Function if defined', g:vader_exception
84 Execute (PreProcess should allow command to be a callback):
85 call ale#linter#PreProcess('testft', {
87 \ 'callback': 'SomeFunction',
88 \ 'executable': 'echo',
89 \ 'command': function('type'),
92 Execute (PreProcess should throw when cwd is not a string):
93 AssertThrows call ale#linter#PreProcess('testft', {
95 \ 'callback': 'SomeFunction',
96 \ 'executable': 'echo',
100 AssertEqual '`cwd` must be a String or Function if defined', g:vader_exception
102 Execute (PreProcess should allow cwd to be a callback):
103 call ale#linter#PreProcess('testft', {
105 \ 'callback': 'SomeFunction',
106 \ 'executable': 'echo',
107 \ 'cwd': function('type'),
111 Execute (PreProcess should allow cwd to be a string):
112 call ale#linter#PreProcess('testft', {
114 \ 'callback': 'SomeFunction',
115 \ 'executable': 'echo',
120 Execute (PreProcess should when the output stream isn't a valid string):
121 AssertThrows call ale#linter#PreProcess('testft', {
123 \ 'callback': 'SomeFunction',
124 \ 'executable': 'echo',
126 \ 'output_stream': 'xxx',
128 AssertEqual "`output_stream` must be 'stdout', 'stderr', or 'both'", g:vader_exception
130 Execute (PreProcess should not throw when everything is correct):
131 call ale#linter#PreProcess('testft', {
133 \ 'callback': 'SomeFunction',
134 \ 'executable': 'echo',
138 Execute (PreProcess should accept an stdout output_stream):
139 call ale#linter#PreProcess('testft', {
141 \ 'callback': 'SomeFunction',
142 \ 'executable': 'echo',
144 \ 'output_stream': 'stdout',
147 Execute (PreProcess should accept an stderr output_stream):
148 call ale#linter#PreProcess('testft', {
150 \ 'callback': 'SomeFunction',
151 \ 'executable': 'echo',
153 \ 'output_stream': 'stderr',
156 Execute (PreProcess should accept a 'both' output_stream):
157 call ale#linter#PreProcess('testft', {
159 \ 'callback': 'SomeFunction',
160 \ 'executable': 'echo',
162 \ 'output_stream': 'both',
165 Execute(PreProcess should process the read_buffer option correctly):
171 \ 'read_buffer': '0',
174 AssertThrows call ale#linter#PreProcess('testft', g:linter)
175 AssertEqual '`read_buffer` must be `0` or `1`', g:vader_exception
177 let g:linter.read_buffer = 0
179 call ale#linter#PreProcess('testft', g:linter)
181 let g:linter.read_buffer = 1
183 call ale#linter#PreProcess('testft', g:linter)
185 Execute(PreProcess should set a default value for read_buffer):
193 AssertEqual 1, ale#linter#PreProcess('testft', g:linter).read_buffer
195 Execute(PreProcess should process the lint_file option correctly):
204 AssertThrows call ale#linter#PreProcess('testft', g:linter)
205 AssertEqual '`lint_file` must be `0`, `1`, or a Function', g:vader_exception
207 let g:linter.lint_file = 0
209 AssertEqual 0, ale#linter#PreProcess('testft', g:linter).lint_file
210 " The default for read_buffer should be 1 when lint_file is 0
211 AssertEqual 1, ale#linter#PreProcess('testft', g:linter).read_buffer
213 let g:linter.lint_file = 1
215 AssertEqual 1, ale#linter#PreProcess('testft', g:linter).lint_file
216 " The default for read_buffer should still be 1
217 AssertEqual 1, ale#linter#PreProcess('testft', g:linter).read_buffer
219 let g:linter.read_buffer = 1
221 " We should be able to set `read_buffer` and `lint_file` at the same time.
222 AssertEqual 1, ale#linter#PreProcess('testft', g:linter).read_buffer
224 let g:linter.lint_file = function('type')
226 Assert type(ale#linter#PreProcess('testft', g:linter).lint_file) is v:t_func
228 Execute(PreProcess should set a default value for lint_file):
236 AssertEqual 0, ale#linter#PreProcess('testft', g:linter).lint_file
238 Execute(PreProcess should set a default value for aliases):
246 AssertEqual [], ale#linter#PreProcess('testft', g:linter).aliases
248 Execute(PreProcess should complain about invalid `aliases` values):
257 AssertThrows call ale#linter#PreProcess('testft', g:linter)
258 AssertEqual '`aliases` must be a List of String values', g:vader_exception
260 let g:linter.aliases = [1]
262 AssertThrows call ale#linter#PreProcess('testft', g:linter)
263 AssertEqual '`aliases` must be a List of String values', g:vader_exception
265 Execute(PreProcess should accept `aliases` lists):
274 AssertEqual [], ale#linter#PreProcess('testft', g:linter).aliases
276 let g:linter.aliases = ['foo', 'bar']
278 AssertEqual ['foo', 'bar'], ale#linter#PreProcess('testft', g:linter).aliases
280 Execute(PreProcess should accept tsserver LSP configuration):
287 \ 'project_root': 'x',
290 AssertEqual 'tsserver', ale#linter#PreProcess('testft', g:linter).lsp
292 Execute(PreProcess should accept stdio LSP configuration):
299 \ 'project_root': 'x',
302 AssertEqual 'stdio', ale#linter#PreProcess('testft', g:linter).lsp
304 Execute(PreProcess should accept LSP server configurations):
309 \ 'language': 'foobar',
310 \ 'project_root': 'x',
313 AssertEqual 'socket', ale#linter#PreProcess('testft', g:linter).lsp
315 Execute(PreProcess should accept let you specify the `language` as a Function):
320 \ 'language': {-> 'foobar'},
321 \ 'project_root': 'x',
324 AssertEqual 'foobar', ale#linter#PreProcess('testft', g:linter).language(bufnr(''))
326 Execute(PreProcess should complain about invalid language values):
332 \ 'project_root': 'x',
335 AssertThrows call ale#linter#PreProcess('testft', g:linter)
336 AssertEqual '`language` must be a String or Function if defined', g:vader_exception
338 Execute(PreProcess should use the filetype as the language string by default):
343 \ 'project_root': 'x',
346 AssertEqual 'testft', ale#linter#PreProcess('testft', g:linter).language
348 Execute(PreProcess should require an `address` for LSP socket configurations):
354 AssertThrows call ale#linter#PreProcess('testft', g:linter)
355 AssertEqual '`address` must be defined for getting the LSP address', g:vader_exception
357 Execute(PreProcess should complain about `address` for non-LSP linters):
360 \ 'callback': 'SomeFunction',
361 \ 'executable': 'echo',
366 AssertThrows call ale#linter#PreProcess('testft', g:linter)
367 AssertEqual '`address` cannot be used when lsp != ''socket''', g:vader_exception
369 Execute(PreProcess accept `address` as a String):
370 let g:linter = ale#linter#PreProcess('testft', {
373 \ 'address': 'foo:123',
375 \ 'project_root': 'x',
378 AssertEqual 'foo:123', ale#linter#GetAddress(0, g:linter)
380 Execute(PreProcess accept address as a Function):
381 let g:linter = ale#linter#PreProcess('testft', {
384 \ 'address': {-> 'foo:123'},
386 \ 'project_root': 'x',
389 AssertEqual 'foo:123', ale#linter#GetAddress(0, g:linter)
391 Execute(PreProcess should complain about invalid address values):
392 AssertThrows call ale#linter#PreProcess('testft', {
397 \ 'project_root': 'x',
399 AssertEqual '`address` must be a String or Function if defined', g:vader_exception
401 Execute(PreProcess should allow the `project_root` to be set as a String):
402 let g:linter = ale#linter#PreProcess('testft', {
405 \ 'address': 'foo:123',
407 \ 'project_root': '/foo/bar',
410 AssertEqual '/foo/bar', ale#lsp_linter#FindProjectRoot(0, g:linter)
412 Execute(PreProcess should `project_root` be set as a Function):
413 let g:linter = ale#linter#PreProcess('testft', {
416 \ 'address': 'foo:123',
418 \ 'project_root': {-> '/foo/bar'},
421 AssertEqual '/foo/bar', ale#lsp_linter#FindProjectRoot(0, g:linter)
423 Execute(PreProcess should complain when `project_root` is invalid):
424 AssertThrows call ale#linter#PreProcess('testft', {
427 \ 'address': 'foo:123',
431 AssertEqual '`project_root` must be a String or Function', g:vader_exception
433 Execute(PreProcess should throw when `initialization_options` is not a Dictionary or callback):
434 AssertThrows call ale#linter#PreProcess('testft', {
439 \ 'project_root': 'x',
440 \ 'initialization_options': 0,
442 AssertEqual '`initialization_options` must be a Dictionary or Function if defined', g:vader_exception
444 Execute(PreProcess should accept `initialization_options` as a Dictionary):
445 let g:linter = ale#linter#PreProcess('testft', {
450 \ 'project_root': 'x',
451 \ 'initialization_options': {'foo': v:true},
454 AssertEqual {'foo': v:true}, ale#lsp_linter#GetOptions(0, g:linter)
456 Execute(PreProcess should accept `initialization_options` as a Function):
457 let g:linter = ale#linter#PreProcess('testft', {
462 \ 'project_root': 'x',
463 \ 'initialization_options': {-> {'foo': v:true}},
466 AssertEqual {'foo': v:true}, ale#lsp_linter#GetOptions(0, g:linter)
468 Execute(PreProcess should accept `lsp_config` as a Dictionary):
474 \ 'project_root': 'x',
475 \ 'lsp_config': {'foo': 'bar'},
478 AssertEqual {'foo': 'bar'}, ale#lsp_linter#GetConfig(0, g:linter)
480 Execute(PreProcess should accept `lsp_config` as a Function):
486 \ 'project_root': 'x',
487 \ 'lsp_config': {-> {'foo': 'bar'}},
490 AssertEqual {'foo': 'bar'}, ale#lsp_linter#GetConfig(0, g:linter)
492 Execute(PreProcess should throw when `lsp_config` is not a Dictionary or Function):
493 AssertThrows call ale#linter#PreProcess('testft', {
498 \ 'project_root': 'x',
501 AssertEqual '`lsp_config` must be a Dictionary or Function if defined', g:vader_exception