diff options
Diffstat (limited to 'test/linter')
-rw-r--r-- | test/linter/test_c_cc.vader | 27 | ||||
-rw-r--r-- | test/linter/test_cpp_cc.vader | 27 |
2 files changed, 50 insertions, 4 deletions
diff --git a/test/linter/test_c_cc.vader b/test/linter/test_c_cc.vader index 953aa238..ce4bd162 100644 --- a/test/linter/test_c_cc.vader +++ b/test/linter/test_c_cc.vader @@ -54,18 +54,41 @@ Execute(The -std flag should be replaced by parsed C flags): AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail -Execute(The header files should use -x c-header): +Execute(gcc should not use -x c-header with header files by default): + call ale#test#SetFilename('../test-files/c/makefile_project/subdir/test.h') + + AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail + +Execute(clang should use -x c-header with header files by default): + let g:executable_map = {'clang': 1} + let b:command_tail = substitute(b:command_tail, '-x c', '-x c-header', '') + + call ale#test#SetFilename('../test-files/c/makefile_project/subdir/test.h') + + AssertLinter 'clang', ale#Escape('clang') . b:command_tail + +Execute(gcc should use -x c-header with header files if configured to do so): + let b:ale_c_cc_use_header_lang_flag = 1 let b:command_tail = substitute(b:command_tail, '-x c', '-x c-header', '') call ale#test#SetFilename('../test-files/c/makefile_project/subdir/test.h') AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail +Execute(clang should not use -x c-header with header files if configured to do so): + let g:executable_map = {'clang': 1} + let b:ale_c_cc_use_header_lang_flag = 0 + + call ale#test#SetFilename('../test-files/c/makefile_project/subdir/test.h') + + AssertLinter 'clang', ale#Escape('clang') . b:command_tail + Execute(The header file extensions should be configurable): + let g:executable_map = {'clang': 1} let b:command_tail = substitute(b:command_tail, '-x c', '-x c-header', '') call ale#assert#SetUpLinterTest('c', 'cc') let b:ale_c_cc_header_exts = ['json'] call ale#test#SetFilename('../test-files/c/json_project/build/compile_commands.json') - AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail + AssertLinter 'clang', ale#Escape('clang') . b:command_tail diff --git a/test/linter/test_cpp_cc.vader b/test/linter/test_cpp_cc.vader index 44fe4521..e6794c09 100644 --- a/test/linter/test_cpp_cc.vader +++ b/test/linter/test_cpp_cc.vader @@ -54,18 +54,41 @@ Execute(The -std flag should be replaced by parsed C flags): AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail -Execute(The header files should use -x c++-header): +Execute(gcc should not use -x c++-header with header files by default): + call ale#test#SetFilename('../test-files/c/hpp_file_project/test.hpp') + + AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail + +Execute(clang++ should use -x c++-header with header files by default): + let g:executable_map = {'clang++': 1} + let b:command_tail = substitute(b:command_tail, '-x c++', '-x c++-header', '') + + call ale#test#SetFilename('../test-files/c/hpp_file_project/test.hpp') + + AssertLinter 'clang++', ale#Escape('clang++') . b:command_tail + +Execute(gcc should use -x c-header with header files if configured to do so): + let b:ale_cpp_cc_use_header_lang_flag = 1 let b:command_tail = substitute(b:command_tail, '-x c++', '-x c++-header', '') call ale#test#SetFilename('../test-files/c/hpp_file_project/test.hpp') AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail +Execute(clang should not use -x c-header with header files if configured to do so): + let g:executable_map = {'clang++': 1} + let b:ale_cpp_cc_use_header_lang_flag = 0 + + call ale#test#SetFilename('../test-files/c/hpp_file_project/test.hpp') + + AssertLinter 'clang++', ale#Escape('clang++') . b:command_tail + Execute(The header file extensions should be configurable): + let g:executable_map = {'clang++': 1} let b:command_tail = substitute(b:command_tail, '-x c++', '-x c++-header', '') call ale#assert#SetUpLinterTest('cpp', 'cc') let b:ale_cpp_cc_header_exts = ['json'] call ale#test#SetFilename('../test-files/c/json_project/build/compile_commands.json') - AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail + AssertLinter 'clang++', ale#Escape('clang++') . b:command_tail |