summaryrefslogtreecommitdiff
path: root/test/handler/test_cppcheck_handler.vader
diff options
context:
space:
mode:
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',
+ \ ])