diff options
author | w0rp <devw0rp@gmail.com> | 2017-05-31 20:01:40 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-05-31 20:01:47 +0100 |
commit | 5e4c302b5bfd916214865c3c3d3808c75d137932 (patch) | |
tree | 65fa154cde77dc8452024929e5226b40752ff1d0 /test | |
parent | 88948e0ee3729b9b31b7cfd7e0efd5fe15143621 (diff) | |
download | ale-5e4c302b5bfd916214865c3c3d3808c75d137932.zip |
Fix #557 - Detect C project roots and include root directories with headers, or include directories
Diffstat (limited to 'test')
-rw-r--r-- | test/test_c_import_paths.vader | 228 | ||||
-rw-r--r-- | test/test_c_projects/configure_project/Makefile | 0 | ||||
-rw-r--r-- | test/test_c_projects/configure_project/configure | 0 | ||||
-rw-r--r-- | test/test_c_projects/configure_project/include/test.h | 0 | ||||
-rw-r--r-- | test/test_c_projects/configure_project/subdir/Makefile | 0 | ||||
-rw-r--r-- | test/test_c_projects/h_file_project/Makefile | 0 | ||||
-rw-r--r-- | test/test_c_projects/h_file_project/subdir/dummy | 0 | ||||
-rw-r--r-- | test/test_c_projects/h_file_project/test.h | 0 | ||||
-rw-r--r-- | test/test_c_projects/hpp_file_project/Makefile | 0 | ||||
-rw-r--r-- | test/test_c_projects/hpp_file_project/subdir/dummy | 0 | ||||
-rw-r--r-- | test/test_c_projects/hpp_file_project/test.hpp | 0 | ||||
-rw-r--r-- | test/test_c_projects/makefile_project/Makefile | 0 | ||||
-rw-r--r-- | test/test_c_projects/makefile_project/include/test.h | 0 | ||||
-rw-r--r-- | test/test_c_projects/makefile_project/subdir/dummy | 0 |
14 files changed, 228 insertions, 0 deletions
diff --git a/test/test_c_import_paths.vader b/test/test_c_import_paths.vader new file mode 100644 index 00000000..66ff6dca --- /dev/null +++ b/test/test_c_import_paths.vader @@ -0,0 +1,228 @@ +Before: + Save g:ale_c_gcc_options + Save g:ale_c_clang_options + Save g:ale_cpp_gcc_options + Save g:ale_cpp_clang_options + + silent! cd /testplugin/test + let g:dir = getcwd() + + let g:ale_c_gcc_options = '' + let g:ale_c_clang_options = '' + let g:ale_cpp_gcc_options = '' + let g:ale_cpp_clang_options = '' + +After: + Restore + + silent execute 'cd ' . fnameescape(g:dir) + unlet! g:dir + call ale#linter#Reset() + +Execute(The C GCC handler should include 'include' directories for projects with a Makefile): + runtime! ale_linters/c/gcc.vim + + cd test_c_projects/makefile_project/subdir + silent noautocmd file file.c + + AssertEqual + \ 'gcc -S -x c -fsyntax-only ' + \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/makefile_project/subdir') . ' ' + \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/makefile_project/include') . ' ' + \ . ' -' + \ , ale_linters#c#gcc#GetCommand(bufnr('')) + +Execute(The C GCC handler should include 'include' directories for projects with a configure file): + runtime! ale_linters/c/gcc.vim + + cd test_c_projects/configure_project/subdir + silent noautocmd file file.c + + AssertEqual + \ 'gcc -S -x c -fsyntax-only ' + \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/configure_project/subdir') . ' ' + \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/configure_project/include') . ' ' + \ . ' -' + \ , ale_linters#c#gcc#GetCommand(bufnr('')) + +Execute(The C GCC handler should include root directories for projects with .h files in them): + runtime! ale_linters/c/gcc.vim + + cd test_c_projects/h_file_project/subdir + silent noautocmd file file.c + + AssertEqual + \ 'gcc -S -x c -fsyntax-only ' + \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/h_file_project/subdir') . ' ' + \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/h_file_project') . ' ' + \ . ' -' + \ , ale_linters#c#gcc#GetCommand(bufnr('')) + +Execute(The C GCC handler should include root directories for projects with .hpp files in them): + runtime! ale_linters/c/gcc.vim + + cd test_c_projects/hpp_file_project/subdir + silent noautocmd file file.c + + AssertEqual + \ 'gcc -S -x c -fsyntax-only ' + \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project/subdir') . ' ' + \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project') . ' ' + \ . ' -' + \ , ale_linters#c#gcc#GetCommand(bufnr('')) + +Execute(The C Clang handler should include 'include' directories for projects with a Makefile): + runtime! ale_linters/c/clang.vim + + cd test_c_projects/makefile_project/subdir + silent noautocmd file file.c + + AssertEqual + \ 'clang -S -x c -fsyntax-only ' + \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/makefile_project/subdir') . ' ' + \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/makefile_project/include') . ' ' + \ . ' -' + \ , ale_linters#c#clang#GetCommand(bufnr('')) + +Execute(The C Clang handler should include 'include' directories for projects with a configure file): + runtime! ale_linters/c/clang.vim + + cd test_c_projects/h_file_project/subdir + silent noautocmd file file.c + + AssertEqual + \ 'clang -S -x c -fsyntax-only ' + \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/h_file_project/subdir') . ' ' + \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/h_file_project') . ' ' + \ . ' -' + \ , ale_linters#c#clang#GetCommand(bufnr('')) + +Execute(The C Clang handler should include root directories for projects with .h files in them): + runtime! ale_linters/c/clang.vim + + cd test_c_projects/h_file_project/subdir + silent noautocmd file file.c + + AssertEqual + \ 'clang -S -x c -fsyntax-only ' + \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/h_file_project/subdir') . ' ' + \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/h_file_project') . ' ' + \ . ' -' + \ , ale_linters#c#clang#GetCommand(bufnr('')) + +Execute(The C Clang handler should include root directories for projects with .hpp files in them): + runtime! ale_linters/c/clang.vim + + cd test_c_projects/hpp_file_project/subdir + silent noautocmd file file.c + + AssertEqual + \ 'clang -S -x c -fsyntax-only ' + \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project/subdir') . ' ' + \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project') . ' ' + \ . ' -' + \ , ale_linters#c#clang#GetCommand(bufnr('')) + +Execute(The C++ GCC handler should include 'include' directories for projects with a Makefile): + runtime! ale_linters/cpp/gcc.vim + + cd test_c_projects/makefile_project/subdir + silent noautocmd file file.cpp + + AssertEqual + \ 'gcc -S -x c++ -fsyntax-only ' + \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/makefile_project/subdir') . ' ' + \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/makefile_project/include') . ' ' + \ . ' -' + \ , ale_linters#cpp#gcc#GetCommand(bufnr('')) + +Execute(The C++ GCC handler should include 'include' directories for projects with a configure file): + runtime! ale_linters/cpp/gcc.vim + + cd test_c_projects/configure_project/subdir + silent noautocmd file file.cpp + + AssertEqual + \ 'gcc -S -x c++ -fsyntax-only ' + \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/configure_project/subdir') . ' ' + \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/configure_project/include') . ' ' + \ . ' -' + \ , ale_linters#cpp#gcc#GetCommand(bufnr('')) + +Execute(The C++ GCC handler should include root directories for projects with .h files in them): + runtime! ale_linters/cpp/gcc.vim + + cd test_c_projects/h_file_project/subdir + silent noautocmd file file.cpp + + AssertEqual + \ 'gcc -S -x c++ -fsyntax-only ' + \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/h_file_project/subdir') . ' ' + \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/h_file_project') . ' ' + \ . ' -' + \ , ale_linters#cpp#gcc#GetCommand(bufnr('')) + +Execute(The C++ GCC handler should include root directories for projects with .hpp files in them): + runtime! ale_linters/cpp/gcc.vim + + cd test_c_projects/hpp_file_project/subdir + silent noautocmd file file.cpp + + AssertEqual + \ 'gcc -S -x c++ -fsyntax-only ' + \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project/subdir') . ' ' + \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project') . ' ' + \ . ' -' + \ , ale_linters#cpp#gcc#GetCommand(bufnr('')) + +Execute(The C++ Clang handler should include 'include' directories for projects with a Makefile): + runtime! ale_linters/cpp/clang.vim + + cd test_c_projects/makefile_project/subdir + silent noautocmd file file.cpp + + AssertEqual + \ 'clang++ -S -x c++ -fsyntax-only ' + \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/makefile_project/subdir') . ' ' + \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/makefile_project/include') . ' ' + \ . ' -' + \ , ale_linters#cpp#clang#GetCommand(bufnr('')) + +Execute(The C++ Clang handler should include 'include' directories for projects with a configure file): + runtime! ale_linters/cpp/clang.vim + + cd test_c_projects/configure_project/subdir + silent noautocmd file file.cpp + + AssertEqual + \ 'clang++ -S -x c++ -fsyntax-only ' + \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/configure_project/subdir') . ' ' + \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/configure_project/include') . ' ' + \ . ' -' + \ , ale_linters#cpp#clang#GetCommand(bufnr('')) + +Execute(The C++ Clang handler should include root directories for projects with .h files in them): + runtime! ale_linters/cpp/clang.vim + + cd test_c_projects/h_file_project/subdir + silent noautocmd file file.cpp + + AssertEqual + \ 'clang++ -S -x c++ -fsyntax-only ' + \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/h_file_project/subdir') . ' ' + \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/h_file_project') . ' ' + \ . ' -' + \ , ale_linters#cpp#clang#GetCommand(bufnr('')) + +Execute(The C++ Clang handler should include root directories for projects with .hpp files in them): + runtime! ale_linters/cpp/clang.vim + + cd test_c_projects/hpp_file_project/subdir + silent noautocmd file file.cpp + + AssertEqual + \ 'clang++ -S -x c++ -fsyntax-only ' + \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project/subdir') . ' ' + \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project') . ' ' + \ . ' -' + \ , ale_linters#cpp#clang#GetCommand(bufnr('')) diff --git a/test/test_c_projects/configure_project/Makefile b/test/test_c_projects/configure_project/Makefile new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/test_c_projects/configure_project/Makefile diff --git a/test/test_c_projects/configure_project/configure b/test/test_c_projects/configure_project/configure new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/test_c_projects/configure_project/configure diff --git a/test/test_c_projects/configure_project/include/test.h b/test/test_c_projects/configure_project/include/test.h new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/test_c_projects/configure_project/include/test.h diff --git a/test/test_c_projects/configure_project/subdir/Makefile b/test/test_c_projects/configure_project/subdir/Makefile new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/test_c_projects/configure_project/subdir/Makefile diff --git a/test/test_c_projects/h_file_project/Makefile b/test/test_c_projects/h_file_project/Makefile new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/test_c_projects/h_file_project/Makefile diff --git a/test/test_c_projects/h_file_project/subdir/dummy b/test/test_c_projects/h_file_project/subdir/dummy new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/test_c_projects/h_file_project/subdir/dummy diff --git a/test/test_c_projects/h_file_project/test.h b/test/test_c_projects/h_file_project/test.h new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/test_c_projects/h_file_project/test.h diff --git a/test/test_c_projects/hpp_file_project/Makefile b/test/test_c_projects/hpp_file_project/Makefile new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/test_c_projects/hpp_file_project/Makefile diff --git a/test/test_c_projects/hpp_file_project/subdir/dummy b/test/test_c_projects/hpp_file_project/subdir/dummy new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/test_c_projects/hpp_file_project/subdir/dummy diff --git a/test/test_c_projects/hpp_file_project/test.hpp b/test/test_c_projects/hpp_file_project/test.hpp new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/test_c_projects/hpp_file_project/test.hpp diff --git a/test/test_c_projects/makefile_project/Makefile b/test/test_c_projects/makefile_project/Makefile new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/test_c_projects/makefile_project/Makefile diff --git a/test/test_c_projects/makefile_project/include/test.h b/test/test_c_projects/makefile_project/include/test.h new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/test_c_projects/makefile_project/include/test.h diff --git a/test/test_c_projects/makefile_project/subdir/dummy b/test/test_c_projects/makefile_project/subdir/dummy new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/test_c_projects/makefile_project/subdir/dummy |