mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-28 14:56:52 +08:00
Fix #677 - Ignore errors from other files for cppcheck
This commit is contained in:
@@ -177,24 +177,3 @@ Execute (Unix format functions should handle Windows paths):
|
||||
\ 'C:\Users\w0rp\AppData\Local\Temp\Xyz123.go:27: foo',
|
||||
\ 'C:\Users\w0rp\AppData\Local\Temp\Xyz123.go:53:10: foo',
|
||||
\ ])
|
||||
|
||||
Execute (HandleCppCheckFormat should handle some example lines of output):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 5,
|
||||
\ 'col': 0,
|
||||
\ 'type': 'W',
|
||||
\ 'text': 'Variable a is assigned a value that is never used. (style)',
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 12,
|
||||
\ 'col': 0,
|
||||
\ 'type': 'E',
|
||||
\ 'text': 'Array a[10] accessed at index 10, which is out of bounds. (error)',
|
||||
\ },
|
||||
\ ],
|
||||
\ ale#handlers#cppcheck#HandleCppCheckFormat(42, [
|
||||
\ '[/tmp/test.c:5]: (style) Variable a is assigned a value that is never used.',
|
||||
\ '[/tmp/test.c:12]: (error) Array a[10] accessed at index 10, which is out of bounds.'
|
||||
\ ])
|
||||
|
||||
38
test/handler/test_cppcheck_handler.vader
Normal file
38
test/handler/test_cppcheck_handler.vader
Normal file
@@ -0,0 +1,38 @@
|
||||
Before:
|
||||
silent! cd /testplugin/test/handler
|
||||
let g:dir = getcwd()
|
||||
|
||||
After:
|
||||
silent execute 'cd ' . fnameescape(g:dir)
|
||||
unlet! g:dir
|
||||
|
||||
Execute(Basic errors should be handled by cppcheck):
|
||||
call ale#test#SetFilename('test.cpp')
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 5,
|
||||
\ 'type': 'E',
|
||||
\ 'text': 'Array ''a[10]'' accessed at index 10, which is out of bounds',
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 7,
|
||||
\ 'type': 'W',
|
||||
\ 'text': 'Some other problem',
|
||||
\ },
|
||||
\ ],
|
||||
\ ale#handlers#cppcheck#HandleCppCheckFormat(bufnr(''), [
|
||||
\ '[test.cpp:5]: (error) Array ''a[10]'' accessed at index 10, which is out of bounds',
|
||||
\ '[test.cpp:7]: (warning) Some other problem',
|
||||
\ ])
|
||||
|
||||
Execute(Problems from other files should be ignored by cppcheck):
|
||||
call ale#test#SetFilename('test.cpp')
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ ],
|
||||
\ ale#handlers#cppcheck#HandleCppCheckFormat(bufnr(''), [
|
||||
\ '[bar.cpp:5]: (error) Array ''a[10]'' accessed at index 10, which is out of bounds',
|
||||
\ ])
|
||||
Reference in New Issue
Block a user