From eb8bd26776fbdc57f0162d729260c4847645e145 Mon Sep 17 00:00:00 2001 From: w0rp Date: Tue, 2 May 2017 21:18:17 +0100 Subject: #392 - Detect and use compile_commands.json for cppcheck --- .../cppcheck_paths/one/compile_commands.json | 0 .../cppcheck_paths/one/two/three/file.c | 0 .../cppcheck_paths/one/two/three/file.cpp | 0 .../test_cppcheck_command_callbacks.vader | 40 ++++++++++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 test/command_callback/cppcheck_paths/one/compile_commands.json create mode 100644 test/command_callback/cppcheck_paths/one/two/three/file.c create mode 100644 test/command_callback/cppcheck_paths/one/two/three/file.cpp create mode 100644 test/command_callback/test_cppcheck_command_callbacks.vader (limited to 'test') diff --git a/test/command_callback/cppcheck_paths/one/compile_commands.json b/test/command_callback/cppcheck_paths/one/compile_commands.json new file mode 100644 index 00000000..e69de29b diff --git a/test/command_callback/cppcheck_paths/one/two/three/file.c b/test/command_callback/cppcheck_paths/one/two/three/file.c new file mode 100644 index 00000000..e69de29b diff --git a/test/command_callback/cppcheck_paths/one/two/three/file.cpp b/test/command_callback/cppcheck_paths/one/two/three/file.cpp new file mode 100644 index 00000000..e69de29b diff --git a/test/command_callback/test_cppcheck_command_callbacks.vader b/test/command_callback/test_cppcheck_command_callbacks.vader new file mode 100644 index 00000000..665b4f13 --- /dev/null +++ b/test/command_callback/test_cppcheck_command_callbacks.vader @@ -0,0 +1,40 @@ +Before: + silent! cd /testplugin/test/command_callback + let b:dir = getcwd() + +After: + silent execute 'cd ' . fnameescape(b:dir) + unlet! b:dir + call ale#linter#Reset() + +Execute(The default C cppcheck command should be correct): + runtime ale_linters/c/cppcheck.vim + + AssertEqual + \ 'cppcheck -q --language=c --enable=style %t', + \ ale_linters#c#cppcheck#GetCommand(bufnr('')) + +Execute(cppcheck for C should detect compile_commands.json files): + runtime ale_linters/c/cppcheck.vim + cd cppcheck_paths/one + + AssertEqual + \ 'cd ' . fnameescape(b:dir . '/cppcheck_paths/one') . ' && ' + \ . 'cppcheck -q --language=c --project=compile_commands.json --enable=style %t', + \ ale_linters#c#cppcheck#GetCommand(bufnr('')) + +Execute(The default C++ cppcheck command should be correct): + runtime ale_linters/cpp/cppcheck.vim + + AssertEqual + \ 'cppcheck -q --language=c++ --enable=style %t', + \ ale_linters#cpp#cppcheck#GetCommand(bufnr('')) + +Execute(cppcheck for C++ should detect compile_commands.json files): + runtime ale_linters/cpp/cppcheck.vim + cd cppcheck_paths/one + + AssertEqual + \ 'cd ' . fnameescape(b:dir . '/cppcheck_paths/one') . ' && ' + \ . 'cppcheck -q --language=c++ --project=compile_commands.json --enable=style %t', + \ ale_linters#cpp#cppcheck#GetCommand(bufnr('')) -- cgit v1.2.3