summaryrefslogtreecommitdiff
path: root/test/command_callback/test_cpp_clang_command_callbacks.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2020-08-19 00:47:39 +0100
committerw0rp <devw0rp@gmail.com>2020-08-19 00:47:39 +0100
commit794224aafa6968dd635a96b66ddf218dfdea38d8 (patch)
tree45e6ab407d7414287251742d8c1222c1e7cac1cc /test/command_callback/test_cpp_clang_command_callbacks.vader
parent92cada99134dd38d441b7a5a55ddbe7d58882c96 (diff)
downloadale-794224aafa6968dd635a96b66ddf218dfdea38d8.zip
#3056 Add tests for parsed C/C++ -std flag handling
Diffstat (limited to 'test/command_callback/test_cpp_clang_command_callbacks.vader')
-rw-r--r--test/command_callback/test_cpp_clang_command_callbacks.vader18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/command_callback/test_cpp_clang_command_callbacks.vader b/test/command_callback/test_cpp_clang_command_callbacks.vader
index e96fd8e7..7d5fe989 100644
--- a/test/command_callback/test_cpp_clang_command_callbacks.vader
+++ b/test/command_callback/test_cpp_clang_command_callbacks.vader
@@ -2,13 +2,25 @@ Before:
Save g:ale_c_parse_makefile
let g:ale_c_parse_makefile = 0
+ let g:get_cflags_return_value = ''
+
+ runtime autoload/ale/c.vim
+
+ function! ale#c#GetCFlags(buffer, output) abort
+ return g:get_cflags_return_value
+ endfunction
+
call ale#assert#SetUpLinterTest('cpp', 'clang')
let b:command_tail = ' -S -x c++ -fsyntax-only -iquote'
\ . ' ' . ale#Escape(getcwd())
\ . ' -std=c++14 -Wall -'
After:
+ unlet! g:get_cflags_return_value
unlet! b:command_tail
+
+ runtime autoload/ale/c.vim
+
call ale#assert#TearDownLinterTest()
Execute(The executable should be configurable):
@@ -17,3 +29,9 @@ Execute(The executable should be configurable):
let b:ale_cpp_clang_executable = 'foobar'
AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail
+
+Execute(The -std flag should be replaced by parsed C flags):
+ let b:command_tail = substitute(b:command_tail, 'c++14', 'c++11 ', '')
+ let g:get_cflags_return_value = '-std=c++11'
+
+ AssertLinter 'clang++', ale#Escape('clang++') . b:command_tail