]> git.madduck.net Git - etc/vim.git/blob - test/linter/test_c_import_paths.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:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / test / linter / test_c_import_paths.vader
1 Before:
2   " Make sure the c.vim file is loaded first.
3   call ale#c#FindProjectRoot(bufnr(''))
4
5   Save g:ale_c_parse_compile_commands
6   Save g:ale_c_parse_makefile
7   Save g:__ale_c_project_filenames
8
9   let g:original_project_filenames = g:__ale_c_project_filenames
10   let g:executable_map = {}
11
12   " Remove the .git/HEAD dir for C import paths for these tests.
13   " The tests run inside of a git repo.
14   let g:__ale_c_project_filenames = filter(
15   \ copy(g:__ale_c_project_filenames),
16   \ 'v:val isnot# ''.git/HEAD'''
17   \)
18
19   let g:ale_c_parse_compile_commands = 0
20   let g:ale_c_parse_makefile = 0
21
22   runtime autoload/ale/engine.vim
23
24   function! ale#engine#IsExecutable(buffer, executable) abort
25     return has_key(g:executable_map, a:executable)
26   endfunction
27
28 After:
29   Restore
30
31   unlet! g:original_project_filenames
32   unlet! g:executable_map
33
34   runtime autoload/ale/engine.vim
35
36   call ale#assert#TearDownLinterTest()
37
38 Execute(The C cc linter should include 'include' directories for projects with a Makefile):
39   call ale#assert#SetUpLinterTest('c', 'cc')
40   call ale#test#SetFilename('../test-files/c/makefile_project/subdir/file.c')
41   let g:ale_c_cc_options = ''
42
43   AssertLinter 'gcc',
44   \ ale#Escape('gcc')
45   \   . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
46   \   . ' -iquote %s:h'
47   \   . ' -I' . ale#Escape(ale#path#Simplify(g:dir .  '/../test-files/c/makefile_project/include'))
48   \   . ' -'
49
50 Execute(The C cc linter should include 'include' directories for projects with a configure file):
51   call ale#assert#SetUpLinterTest('c', 'cc')
52   call ale#test#SetFilename('../test-files/c/configure_project/subdir/file.c')
53   let g:ale_c_cc_options = ''
54
55   AssertLinter 'gcc',
56   \ ale#Escape('gcc')
57   \   . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
58   \   . ' -iquote %s:h'
59   \   . ' -I' . ale#Escape(ale#path#Simplify(g:dir .  '/../test-files/c/configure_project/include'))
60   \   . ' -'
61
62 Execute(The C cc linter should include root directories for projects with .h files in them):
63   call ale#assert#SetUpLinterTest('c', 'cc')
64   call ale#test#SetFilename('../test-files/c/h_file_project/subdir/file.c')
65   let g:ale_c_cc_options = ''
66
67   AssertLinter 'gcc',
68   \ ale#Escape('gcc')
69   \   . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
70   \   . ' -iquote %s:h'
71   \   . ' -I' . ale#Escape(ale#path#Simplify(g:dir .  '/../test-files/c/h_file_project'))
72   \   . ' -'
73
74 Execute(The C cc linter should include root directories for projects with .hpp files in them):
75   call ale#assert#SetUpLinterTest('c', 'cc')
76   call ale#test#SetFilename('../test-files/c/hpp_file_project/subdir/file.c')
77   let g:ale_c_cc_options = ''
78
79   AssertLinter 'gcc',
80   \ ale#Escape('gcc')
81   \   . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
82   \   . ' -iquote %s:h'
83   \   . ' -I' . ale#Escape(ale#path#Simplify(g:dir .  '/../test-files/c/hpp_file_project'))
84   \   . ' -'
85
86 Execute(The C ClangTidy handler should include 'include' directories for projects with a Makefile):
87   call ale#assert#SetUpLinterTest('c', 'clangtidy')
88   call ale#test#SetFilename('../test-files/c/makefile_project/subdir/file.cpp')
89   let g:ale_c_clangtidy_options = ''
90
91   AssertLinter 'clang-tidy',
92   \ ale#Escape('clang-tidy')
93   \ . ' %s '
94   \ . '-- -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/makefile_project/include'))
95
96 Execute(The C++ cc linter should include 'include' directories for projects with a Makefile):
97   call ale#assert#SetUpLinterTest('cpp', 'cc')
98   call ale#test#SetFilename('../test-files/c/makefile_project/subdir/file.cpp')
99   let g:ale_cpp_cc_options = ''
100
101   AssertLinter 'gcc',
102   \   ale#Escape('gcc')
103   \   . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
104   \   . ' -iquote %s:h'
105   \   . ' -I' . ale#Escape(ale#path#Simplify(g:dir .  '/../test-files/c/makefile_project/include'))
106   \   . ' -'
107
108 Execute(The C++ cc linter should include 'include' directories for projects with a configure file):
109   call ale#assert#SetUpLinterTest('cpp', 'cc')
110   call ale#test#SetFilename('../test-files/c/configure_project/subdir/file.cpp')
111   let g:ale_cpp_cc_options = ''
112
113   AssertLinter 'gcc',
114   \   ale#Escape('gcc')
115   \   . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
116   \   . ' -iquote %s:h'
117   \   . ' -I' . ale#Escape(ale#path#Simplify(g:dir .  '/../test-files/c/configure_project/include'))
118   \   . ' -'
119
120 Execute(The C++ cc linter should include root directories for projects with .h files in them):
121   call ale#assert#SetUpLinterTest('cpp', 'cc')
122   call ale#test#SetFilename('../test-files/c/h_file_project/subdir/file.cpp')
123   let g:ale_cpp_cc_options = ''
124
125   AssertLinter 'gcc',
126   \   ale#Escape('gcc')
127   \   . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
128   \   . ' -iquote %s:h'
129   \   . ' -I' . ale#Escape(ale#path#Simplify(g:dir .  '/../test-files/c/h_file_project'))
130   \   . ' -'
131
132 Execute(The C++ cc linter should include root directories for projects with .hpp files in them):
133   call ale#assert#SetUpLinterTest('cpp', 'cc')
134   call ale#test#SetFilename('../test-files/c/hpp_file_project/subdir/file.cpp')
135   let g:ale_cpp_cc_options = ''
136
137   AssertLinter 'gcc',
138   \   ale#Escape('gcc')
139   \   . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
140   \   . ' -iquote %s:h'
141   \   . ' -I' . ale#Escape(ale#path#Simplify(g:dir .  '/../test-files/c/hpp_file_project'))
142   \   . ' -'
143
144 Execute(The C++ ClangTidy handler should include json folders for projects with suitable build directory in them):
145   call ale#assert#SetUpLinterTest('cpp', 'clangtidy')
146   call ale#test#SetFilename('../test-files/c/json_project/subdir/file.cpp')
147
148   AssertLinter 'clang-tidy',
149   \ ale#Escape('clang-tidy')
150   \   . ' %s '
151   \   . '-p ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/json_project/build'))
152
153 Execute(The C++ ClangTidy handler should include 'include' directories for projects with a Makefile):
154   call ale#assert#SetUpLinterTest('cpp', 'clangtidy')
155   call ale#test#SetFilename('../test-files/c/makefile_project/subdir/file.cpp')
156   let g:ale_cpp_clangtidy_options = ''
157
158   AssertLinter 'clang-tidy',
159   \ ale#Escape('clang-tidy')
160   \ . ' %s '
161   \ . '-- -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/makefile_project/include'))
162