summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-07-16 23:35:10 +0100
committerw0rp <devw0rp@gmail.com>2017-07-16 23:35:10 +0100
commitfe70742bb930a196b08180da9b251e141d95707c (patch)
treedb14111b7707cdd1014da9c75260c123850ed975 /test
parent9e8387890044726538a7b5f108efdf6a82d59b00 (diff)
downloadale-fe70742bb930a196b08180da9b251e141d95707c.zip
#711 - Make the clangcheck executable configurable
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_cpp_clangcheck_command_callbacks.vader54
1 files changed, 54 insertions, 0 deletions
diff --git a/test/command_callback/test_cpp_clangcheck_command_callbacks.vader b/test/command_callback/test_cpp_clangcheck_command_callbacks.vader
new file mode 100644
index 00000000..e51ba3d2
--- /dev/null
+++ b/test/command_callback/test_cpp_clangcheck_command_callbacks.vader
@@ -0,0 +1,54 @@
+Before:
+ Save g:ale_cpp_clangcheck_executable
+ Save g:ale_cpp_clangcheck_options
+
+ unlet! g:ale_cpp_clangcheck_executable
+ unlet! b:ale_cpp_clangcheck_executable
+ unlet! g:ale_cpp_clangcheck_options
+ unlet! b:ale_cpp_clangcheck_options
+
+ runtime ale_linters/cpp/clangcheck.vim
+
+After:
+ Restore
+ unlet! b:command_tail
+ unlet! b:ale_cpp_clangcheck_executable
+ unlet! b:ale_cpp_clangcheck_options
+ unlet! b:ale_c_build_dir
+ call ale#linter#Reset()
+
+Execute(The executable should be configurable):
+ AssertEqual 'clang-check', ale_linters#cpp#clangcheck#GetExecutable(bufnr(''))
+
+ let b:ale_cpp_clangcheck_executable = 'foobar'
+
+ AssertEqual 'foobar', ale_linters#cpp#clangcheck#GetExecutable(bufnr(''))
+
+Execute(The executable should be used in the command):
+ AssertEqual
+ \ ale#Escape('clang-check') . ' -analyze %s',
+ \ ale_linters#cpp#clangcheck#GetCommand(bufnr(''))
+
+ let b:ale_cpp_clangcheck_executable = 'foobar'
+
+ AssertEqual
+ \ ale#Escape('foobar') . ' -analyze %s',
+ \ ale_linters#cpp#clangcheck#GetCommand(bufnr(''))
+
+Execute(The options should be configurable):
+ let b:ale_cpp_clangcheck_options = '--something'
+
+ AssertEqual
+ \ ale#Escape('clang-check') . ' -analyze %s --something',
+ \ ale_linters#cpp#clangcheck#GetCommand(bufnr(''))
+
+Execute(The build directory should be used when set):
+ let b:ale_cpp_clangcheck_options = '--something'
+ let b:ale_c_build_dir = '/foo/bar'
+
+ AssertEqual
+ \ ale#Escape('clang-check')
+ \ . ' -analyze %s '
+ \ . '--something -p '
+ \ . ale#Escape('/foo/bar'),
+ \ ale_linters#cpp#clangcheck#GetCommand(bufnr(''))