mirror of
https://github.com/dense-analysis/ale.git
synced 2026-03-14 18:58:31 +08:00
Massively reduce the amount of code needed for linter tests
This commit is contained in:
@@ -1,42 +1,17 @@
|
||||
Before:
|
||||
Save g:ale_cpp_cpplint_executable
|
||||
Save g:ale_cpp_cpplint_options
|
||||
|
||||
unlet! g:ale_cpp_cpplint_executable
|
||||
unlet! b:ale_cpp_cpplint_executable
|
||||
unlet! g:ale_cpp_cpplint_options
|
||||
unlet! b:ale_cpp_cpplint_options
|
||||
|
||||
runtime ale_linters/cpp/cpplint.vim
|
||||
call ale#assert#SetUpLinterTest('cpp', 'cpplint')
|
||||
|
||||
After:
|
||||
Restore
|
||||
unlet! b:command_tail
|
||||
unlet! b:ale_cpp_cpplint_executable
|
||||
unlet! b:ale_cpp_cpplint_options
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertEqual 'cpplint', ale_linters#cpp#cpplint#GetExecutable(bufnr(''))
|
||||
AssertLinter 'cpplint', ale#Escape('cpplint') . ' %s'
|
||||
|
||||
let b:ale_cpp_cpplint_executable = 'foobar'
|
||||
|
||||
AssertEqual 'foobar', ale_linters#cpp#cpplint#GetExecutable(bufnr(''))
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' %s'
|
||||
|
||||
Execute(The executable should be used in the command):
|
||||
AssertEqual
|
||||
\ ale#Escape('cpplint') . ' %s',
|
||||
\ ale_linters#cpp#cpplint#GetCommand(bufnr(''))
|
||||
|
||||
let b:ale_cpp_cpplint_executable = 'foobar'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('foobar') . ' %s',
|
||||
\ ale_linters#cpp#cpplint#GetCommand(bufnr(''))
|
||||
\
|
||||
Execute(The options should be configurable):
|
||||
let b:ale_cpp_cpplint_options = '--something'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('cpplint') . ' --something %s',
|
||||
\ ale_linters#cpp#cpplint#GetCommand(bufnr(''))
|
||||
AssertLinter 'cpplint', ale#Escape('cpplint') . ' --something %s'
|
||||
|
||||
Reference in New Issue
Block a user