2017-07-16 21:11:43 +00:00
|
|
|
Before:
|
2018-07-15 17:24:53 +00:00
|
|
|
call ale#assert#SetUpLinterTest('cpp', 'cppcheck')
|
2021-02-06 20:13:28 +00:00
|
|
|
let b:command_tail = ' -q --language=c++ --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') . ' --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'
|
|
|
|
|
2021-03-01 20:11:10 +00:00
|
|
|
AssertLinterCwd ''
|
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')
|
|
|
|
|
2021-03-01 20:11:10 +00:00
|
|
|
AssertLinterCwd ale#path#Simplify(g:dir . '/cppcheck_paths/one')
|
|
|
|
AssertLinter 'cppcheck', ale#Escape('cppcheck')
|
2019-06-03 21:14:18 +00:00
|
|
|
\ . ' -q --language=c++'
|
2021-02-06 20:13:28 +00:00
|
|
|
\ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
2019-06-03 21:14:18 +00:00
|
|
|
\ . ' --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')
|
|
|
|
|
2021-03-01 20:11:10 +00:00
|
|
|
AssertLinterCwd ale#path#Simplify(g:dir . '/cppcheck_paths/with_build_dir')
|
|
|
|
AssertLinter 'cppcheck', ale#Escape('cppcheck')
|
2019-05-20 21:08:03 +00:00
|
|
|
\ . ' -q --language=c++'
|
2021-02-06 20:13:28 +00:00
|
|
|
\ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
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++'
|
2021-02-06 20:13:28 +00:00
|
|
|
\ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
2019-06-03 20:49:51 +00:00
|
|
|
\ . ' --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
|
|
|
|
|
2021-03-01 20:11:10 +00:00
|
|
|
AssertLinterCwd ale#path#Simplify(g:dir . '/cppcheck_paths/one')
|
|
|
|
AssertLinter 'cppcheck', ale#Escape('cppcheck')
|
2019-06-03 20:49:51 +00:00
|
|
|
\ . ' -q --language=c++'
|
2021-02-06 20:13:28 +00:00
|
|
|
\ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
2019-06-03 20:49:51 +00:00
|
|
|
\ . ' --enable=style'
|
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/cppcheck_paths/one'))
|
|
|
|
\ . ' %t'
|