2017-07-16 21:11:43 +00:00
|
|
|
Before:
|
2018-07-15 17:24:53 +00:00
|
|
|
call ale#assert#SetUpLinterTest('cpp', 'cppcheck')
|
2019-06-03 20:49:51 +00:00
|
|
|
let b:command_tail = ' -q --language=c++ --enable=style -I' . ale#Escape(ale#path#Simplify(g:dir)) .' %t'
|
2017-07-16 21:11:43 +00:00
|
|
|
|
|
|
|
After:
|
2019-06-03 20:49:51 +00:00
|
|
|
" Remove a test file we might open for some tests.
|
|
|
|
if &buftype != 'nofile'
|
|
|
|
:q!
|
|
|
|
set buftype=nofile
|
|
|
|
endif
|
|
|
|
|
2017-07-16 21:11:43 +00:00
|
|
|
unlet! b:command_tail
|
2018-07-15 17:24:53 +00:00
|
|
|
call ale#assert#TearDownLinterTest()
|
2017-07-16 21:11:43 +00:00
|
|
|
|
|
|
|
Execute(The executable should be configurable):
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'cppcheck', ale#Escape('cppcheck') . b:command_tail
|
2017-07-16 21:11:43 +00:00
|
|
|
|
|
|
|
let b:ale_cpp_cppcheck_executable = 'foobar'
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail
|
2017-07-16 21:11:43 +00:00
|
|
|
|
|
|
|
Execute(cppcheck for C++ should detect compile_commands.json files):
|
|
|
|
call ale#test#SetFilename('cppcheck_paths/one/foo.cpp')
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'cppcheck',
|
2019-05-20 21:08:03 +00:00
|
|
|
\ ale#path#CdString(ale#path#Simplify(g:dir . '/cppcheck_paths/one'))
|
2017-07-16 21:11:43 +00:00
|
|
|
\ . ale#Escape('cppcheck')
|
2019-06-03 21:14:18 +00:00
|
|
|
\ . ' -q --language=c++'
|
|
|
|
\ . ' --project=' . ale#Escape('compile_commands.json')
|
|
|
|
\ . ' --enable=style %t'
|
2019-05-20 21:08:03 +00:00
|
|
|
|
|
|
|
Execute(cppcheck for C++ should detect compile_commands.json files in build directories):
|
|
|
|
call ale#test#SetFilename('cppcheck_paths/with_build_dir/foo.cpp')
|
|
|
|
|
|
|
|
AssertLinter 'cppcheck',
|
|
|
|
\ ale#path#CdString(ale#path#Simplify(g:dir . '/cppcheck_paths/with_build_dir'))
|
|
|
|
\ . ale#Escape('cppcheck')
|
|
|
|
\ . ' -q --language=c++'
|
2019-05-20 21:11:49 +00:00
|
|
|
\ . ' --project=' . ale#Escape(ale#path#Simplify('build/compile_commands.json'))
|
2019-05-20 21:08:03 +00:00
|
|
|
\ . ' --enable=style %t'
|
2019-06-03 20:49:51 +00:00
|
|
|
|
|
|
|
Execute(cppcheck for C++ should include file dir if compile_commands.json file is not found):
|
|
|
|
call ale#test#SetFilename('cppcheck_paths/foo.cpp')
|
|
|
|
|
|
|
|
AssertLinter 'cppcheck',
|
|
|
|
\ ale#Escape('cppcheck')
|
|
|
|
\ . ' -q --language=c++'
|
|
|
|
\ . ' --enable=style'
|
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/cppcheck_paths'))
|
|
|
|
\ . ' %t'
|
|
|
|
|
|
|
|
Execute(cppcheck for C++ should ignore compile_commands.json file if buffer is modified):
|
|
|
|
call ale#test#SetFilename('cppcheck_paths/one/foo.cpp')
|
|
|
|
|
|
|
|
set buftype=
|
|
|
|
set modified
|
|
|
|
|
|
|
|
AssertLinter 'cppcheck',
|
|
|
|
\ ale#path#CdString(ale#path#Simplify(g:dir . '/cppcheck_paths/one'))
|
|
|
|
\ . ale#Escape('cppcheck')
|
|
|
|
\ . ' -q --language=c++'
|
|
|
|
\ . ' --enable=style'
|
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/cppcheck_paths/one'))
|
|
|
|
\ . ' %t'
|