#333 Add the List needed for the lint_file option, and option itself. Neither do anything meaningful yet

This commit is contained in:
w0rp
2017-03-08 00:23:14 +00:00
parent 21caf54543
commit 1c3f0b1e19
4 changed files with 60 additions and 5 deletions

View File

@@ -282,4 +282,44 @@ Execute(PreProcess should set a default value for read_buffer):
\ 'command': 'x',
\}
AssertEqual ale#linter#PreProcess(g:linter).read_buffer, 1
AssertEqual 1, ale#linter#PreProcess(g:linter).read_buffer
Execute(PreProcess should process the lint_file option correctly):
let g:linter = {
\ 'name': 'x',
\ 'callback': 'x',
\ 'executable': 'x',
\ 'command': 'x',
\ 'lint_file': 'x',
\}
AssertThrows call ale#linter#PreProcess(g:linter)
AssertEqual '`lint_file` must be `0` or `1`', g:vader_exception
let g:linter.lint_file = 0
AssertEqual 0, ale#linter#PreProcess(g:linter).lint_file
" The default for read_buffer should be 1 when lint_file is 0
AssertEqual 1, ale#linter#PreProcess(g:linter).read_buffer
let g:linter.lint_file = 1
AssertEqual 1, ale#linter#PreProcess(g:linter).lint_file
" The default for read_buffer should change to 0 when lint_file is 1.
AssertEqual 0, ale#linter#PreProcess(g:linter).read_buffer
let g:linter.read_buffer = 1
" We shouldn't be able to set both options to 1 at the same time.
AssertThrows call ale#linter#PreProcess(g:linter)
AssertEqual 'Only one of `lint_file` or `read_buffer` can be `1`', g:vader_exception
Execute(PreProcess should set a default value for lint_file):
let g:linter = {
\ 'name': 'x',
\ 'callback': 'x',
\ 'executable': 'x',
\ 'command': 'x',
\}
AssertEqual 0, ale#linter#PreProcess(g:linter).lint_file

View File

@@ -1,6 +1,6 @@
Before:
let g:testlinter1 = {'name': 'testlinter1', 'executable': 'testlinter1', 'command': 'testlinter1', 'callback': 'testCB1', 'output_stream': 'stdout', 'read_buffer': 1}
let g:testlinter2 = {'name': 'testlinter2', 'executable': 'testlinter2', 'command': 'testlinter2', 'callback': 'testCB2', 'output_stream': 'stdout', 'read_buffer': 0}
let g:testlinter1 = {'name': 'testlinter1', 'executable': 'testlinter1', 'command': 'testlinter1', 'callback': 'testCB1', 'output_stream': 'stdout', 'read_buffer': 1, 'lint_file': 0}
let g:testlinter2 = {'name': 'testlinter2', 'executable': 'testlinter2', 'command': 'testlinter2', 'callback': 'testCB2', 'output_stream': 'stdout', 'read_buffer': 0, 'lint_file': 1}
call ale#linter#Reset()
let g:ale_linters = {}
@@ -40,4 +40,4 @@ Then (Linters for dot-seperated filetypes should be properly handled):
AssertEqual [g:testlinter1, g:testlinter2], ale#linter#Get('testft1.testft2')
Execute (Try to load a linter from disk):
AssertEqual [{'name': 'testlinter', 'output_stream': 'stdout', 'executable': 'testlinter', 'command': 'testlinter', 'callback': 'testCB', 'read_buffer': 1}], ale#linter#Get('testft')
AssertEqual [{'name': 'testlinter', 'output_stream': 'stdout', 'executable': 'testlinter', 'command': 'testlinter', 'callback': 'testCB', 'read_buffer': 1, 'lint_file': 0}], ale#linter#Get('testft')