summaryrefslogtreecommitdiff
path: root/test/handler/test_cppcheck_handler.vader
blob: 51efad4e288027a177a118b16b9ef63aeea8ba15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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',
  \ ])