summaryrefslogtreecommitdiff
path: root/test/handler/test_cppcheck_handler.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-06-22 14:08:58 +0100
committerw0rp <devw0rp@gmail.com>2017-06-22 14:08:58 +0100
commitfbf8ccb882eb7819011fa837ea2b4930ed4fa9c7 (patch)
tree5c45bf6cebd0724c23ab641da022edc70a5eb056 /test/handler/test_cppcheck_handler.vader
parent47401a6eda6f86f88ff476bf62c6093685e93b35 (diff)
downloadale-fbf8ccb882eb7819011fa837ea2b4930ed4fa9c7.zip
Fix #677 - Ignore errors from other files for cppcheck
Diffstat (limited to 'test/handler/test_cppcheck_handler.vader')
-rw-r--r--test/handler/test_cppcheck_handler.vader38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/handler/test_cppcheck_handler.vader b/test/handler/test_cppcheck_handler.vader
new file mode 100644
index 00000000..51efad4e
--- /dev/null
+++ b/test/handler/test_cppcheck_handler.vader
@@ -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',
+ \ ])