2017-08-30 13:59:40 -04:00
|
|
|
Before:
|
2018-07-15 13:24:53 -04:00
|
|
|
call ale#assert#SetUpLinterTest('thrift', 'thrift')
|
|
|
|
let b:suffix = ' -out ' . ale#Escape('TEMP_DIR') . ' %t'
|
2017-08-30 13:59:40 -04:00
|
|
|
|
|
|
|
function! GetCommand(buffer) abort
|
|
|
|
call ale#engine#InitBufferInfo(a:buffer)
|
2017-10-05 17:31:00 -04:00
|
|
|
let l:command = ale_linters#thrift#thrift#GetCommand(a:buffer)
|
2017-08-30 13:59:40 -04:00
|
|
|
call ale#engine#Cleanup(a:buffer)
|
2017-10-05 17:31:00 -04:00
|
|
|
|
|
|
|
let l:split_command = split(l:command)
|
|
|
|
let l:index = index(l:split_command, '-out')
|
|
|
|
|
|
|
|
if l:index >= 0
|
|
|
|
let l:split_command[l:index + 1] = 'TEMP'
|
|
|
|
endif
|
|
|
|
|
|
|
|
return join(l:split_command)
|
2017-08-30 13:59:40 -04:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
After:
|
2018-07-15 13:24:53 -04:00
|
|
|
unlet! b:suffix
|
2017-08-30 13:59:40 -04:00
|
|
|
delfunction GetCommand
|
2018-07-15 13:24:53 -04:00
|
|
|
call ale#assert#TearDownLinterTest()
|
2017-08-30 13:59:40 -04:00
|
|
|
|
2018-07-15 13:24:53 -04:00
|
|
|
Execute(The default command should be correct):
|
2018-09-14 17:56:15 -04:00
|
|
|
AssertLinter 'thrift', ale#Escape('thrift') . ' --gen cpp -I . -strict' . b:suffix
|
2017-08-30 13:59:40 -04:00
|
|
|
|
2018-07-15 13:24:53 -04:00
|
|
|
Execute(The executable should be configurable):
|
2017-08-30 13:59:40 -04:00
|
|
|
let b:ale_thrift_thrift_executable = 'foobar'
|
|
|
|
|
2018-09-14 17:56:15 -04:00
|
|
|
AssertLinter 'foobar', ale#Escape('foobar') . ' --gen cpp -I . -strict' . b:suffix
|
2017-08-30 13:59:40 -04:00
|
|
|
|
|
|
|
Execute(The list of generators should be configurable):
|
|
|
|
let b:ale_thrift_thrift_generators = ['java', 'py:dynamic']
|
2017-10-05 17:31:00 -04:00
|
|
|
|
2018-07-15 13:24:53 -04:00
|
|
|
AssertLinter 'thrift', ale#Escape('thrift')
|
2018-09-14 17:56:15 -04:00
|
|
|
\ . ' --gen java --gen py:dynamic -I . -strict' . b:suffix
|
2017-08-30 13:59:40 -04:00
|
|
|
|
|
|
|
let b:ale_thrift_thrift_generators = []
|
|
|
|
|
2018-09-14 17:56:15 -04:00
|
|
|
AssertLinter 'thrift', ale#Escape('thrift') . ' --gen cpp -I . -strict' . b:suffix
|
2017-08-30 13:59:40 -04:00
|
|
|
|
2017-10-05 17:31:00 -04:00
|
|
|
Execute(The list of include paths should be configurable):
|
2017-08-30 13:59:40 -04:00
|
|
|
let b:ale_thrift_thrift_includes = ['included/path']
|
|
|
|
|
2018-07-15 13:24:53 -04:00
|
|
|
AssertLinter 'thrift', ale#Escape('thrift')
|
|
|
|
\ . ' --gen cpp -I included/path -strict' . b:suffix
|
2017-08-30 13:59:40 -04:00
|
|
|
|
2017-10-05 17:31:00 -04:00
|
|
|
Execute(The string of compiler options should be configurable):
|
2017-08-30 13:59:40 -04:00
|
|
|
let b:ale_thrift_thrift_options = '-strict --allow-64bit-consts'
|
2017-10-05 17:31:00 -04:00
|
|
|
|
2018-07-15 13:24:53 -04:00
|
|
|
AssertLinter 'thrift', ale#Escape('thrift')
|
2018-09-14 17:56:15 -04:00
|
|
|
\ . ' --gen cpp -I . -strict --allow-64bit-consts' . b:suffix
|