summaryrefslogtreecommitdiff
path: root/test/handler
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
parent47401a6eda6f86f88ff476bf62c6093685e93b35 (diff)
downloadale-fbf8ccb882eb7819011fa837ea2b4930ed4fa9c7.zip
Fix #677 - Ignore errors from other files for cppcheck
Diffstat (limited to 'test/handler')
-rw-r--r--test/handler/test_common_handlers.vader21
-rw-r--r--test/handler/test_cppcheck_handler.vader38
2 files changed, 38 insertions, 21 deletions
diff --git a/test/handler/test_common_handlers.vader b/test/handler/test_common_handlers.vader
index 9a273946..65026d80 100644
--- a/test/handler/test_common_handlers.vader
+++ b/test/handler/test_common_handlers.vader
@@ -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.'
- \ ])
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',
+ \ ])