blob: 43487f424dca6136cd29354d49121b7b14fcf431 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
Before:
Save g:ale_thrift_thrift_executable
Save g:ale_thrift_thrift_generators
Save g:ale_thrift_thrift_includes
Save g:ale_thrift_thrift_options
unlet! b:ale_thrift_thrift_executable
unlet! b:ale_thrift_thrift_generators
unlet! b:ale_thrift_thrift_includes
unlet! b:ale_thrift_thrift_options
function! GetCommand(buffer) abort
call ale#engine#InitBufferInfo(a:buffer)
let l:result = ale_linters#thrift#thrift#GetCommand(a:buffer)
call ale#engine#Cleanup(a:buffer)
return l:result
endfunction
runtime ale_linters/thrift/thrift.vim
After:
Restore
delfunction GetCommand
unlet! b:ale_thrift_thrift_executable
unlet! b:ale_thrift_thrift_generators
unlet! b:ale_thrift_thrift_includes
unlet! b:ale_thrift_thrift_options
call ale#linter#Reset()
Execute(The executable should be configurable):
AssertEqual 'thrift', ale_linters#thrift#thrift#GetExecutable(bufnr(''))
let b:ale_thrift_thrift_executable = 'foobar'
AssertEqual 'foobar', ale_linters#thrift#thrift#GetExecutable(bufnr(''))
Execute(The executable should be used in the command):
Assert GetCommand(bufnr('%')) =~# "^'thrift'"
let b:ale_thrift_thrift_executable = 'foobar'
Assert GetCommand(bufnr('%')) =~# "^'foobar'"
Execute(The list of generators should be configurable):
Assert GetCommand(bufnr('%')) =~# '--gen cpp'
let b:ale_thrift_thrift_generators = ['java', 'py:dynamic']
Assert GetCommand(bufnr('%')) =~# '--gen java --gen py:dynamic'
let b:ale_thrift_thrift_generators = []
Assert GetCommand(bufnr('%')) =~# '--gen cpp'
Execute(The list of include paths should be configurable):
Assert GetCommand(bufnr('%')) !~# '-I'
let b:ale_thrift_thrift_includes = ['included/path']
Assert GetCommand(bufnr('%')) =~# '-I included/path'
Execute(The string of compiler options should be configurable):
Assert GetCommand(bufnr('%')) =~# '-strict'
let b:ale_thrift_thrift_options = '-strict --allow-64bit-consts'
Assert GetCommand(bufnr('%')) =~# '-strict --allow-64bit-consts'
|