]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/linter/test_cpp_cppcheck.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Do not set EDITOR/VISUAL for shell
[etc/vim.git] / .vim / bundle / ale / test / linter / test_cpp_cppcheck.vader
1 Before:
2   call ale#assert#SetUpLinterTest('cpp', 'cppcheck')
3   let b:command_tail = ' -q --language=c++ --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') . ' --enable=style -I' . ale#Escape(ale#path#Simplify(g:dir)) .' %t'
4
5 After:
6   " Remove a test file we might open for some tests.
7   if &buftype != 'nofile'
8     set nomodified
9     set buftype=nofile
10   endif
11
12   unlet! b:rel_file_path
13   unlet! b:command_tail
14   call ale#assert#TearDownLinterTest()
15
16 Execute(The executable should be configurable):
17   AssertLinter 'cppcheck', ale#Escape('cppcheck') . b:command_tail
18
19   let b:ale_cpp_cppcheck_executable = 'foobar'
20
21   AssertLinterCwd ''
22   AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail
23
24 Execute(cppcheck for C++ should detect compile_commands.json files):
25   let b:rel_file_path = '../test-files/cppcheck/one/foo.cpp'
26   call ale#test#SetFilename(b:rel_file_path)
27
28   AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/cppcheck/one')
29   AssertLinter 'cppcheck', ale#Escape('cppcheck')
30   \   . ' -q --language=c++'
31   \   . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
32   \   . ' --project=' . ale#Escape('compile_commands.json')
33   \   . ' --file-filter=' . ale#Escape(ale#test#GetFilename(b:rel_file_path))
34   \   . ' --enable=style %t'
35
36 Execute(cppcheck for C++ should detect compile_commands.json files in build directories):
37   let b:rel_file_path = '../test-files/cppcheck/with_build_dir/foo.cpp'
38   call ale#test#SetFilename(b:rel_file_path)
39
40   AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/cppcheck/with_build_dir')
41   AssertLinter 'cppcheck', ale#Escape('cppcheck')
42   \   . ' -q --language=c++'
43   \   . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
44   \   . ' --project=' . ale#Escape(ale#path#Simplify('build/compile_commands.json'))
45   \   . ' --file-filter=' . ale#Escape(ale#test#GetFilename(b:rel_file_path))
46   \   . ' --enable=style %t'
47
48 Execute(cppcheck for C++ should include file dir if compile_commands.json file is not found):
49   call ale#test#SetFilename('../test-files/cppcheck/foo.cpp')
50
51   AssertLinter 'cppcheck',
52   \   ale#Escape('cppcheck')
53   \   . ' -q --language=c++'
54   \   . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
55   \   . ' --enable=style'
56   \   . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/cppcheck'))
57   \   . ' %t'
58
59 Execute(cppcheck for C++ header should include file dir and not use compile_commands.json):
60   call ale#test#SetFilename('../test-files/cppcheck/one/foo.hpp')
61
62   AssertLinter 'cppcheck',
63   \   ale#Escape('cppcheck')
64   \   . ' -q --language=c++'
65   \   . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
66   \   . '  -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/cppcheck/one'))
67   \   . ' --suppress=unusedStructMember'
68   \   . ' --enable=style'
69   \   . ' %t'
70
71 Execute(cppcheck for C++ should ignore compile_commands.json file if buffer is modified):
72   call ale#test#SetFilename('../test-files/cppcheck/one/foo.cpp')
73
74   set buftype=
75   set modified
76
77   AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/cppcheck/one')
78   AssertLinter 'cppcheck', ale#Escape('cppcheck')
79   \   . ' -q --language=c++'
80   \   . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
81   \   . ' --enable=style'
82   \   . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/cppcheck/one'))
83   \   . ' %t'