diff options
author | w0rp <devw0rp@gmail.com> | 2017-04-11 20:32:57 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-04-11 20:32:57 +0100 |
commit | b06b832447253404180ce6a97927755e4ae68c22 (patch) | |
tree | b8b4b0592ffc245257869edca0066b425e1806f6 /test/c_tests/test_gcc.vader | |
parent | 8b890caa31411cd022156dca8e4c7f4c5fb65fc9 (diff) | |
download | ale-b06b832447253404180ce6a97927755e4ae68c22.zip |
#392 Report errors inside of headers, in a very basic way
Diffstat (limited to 'test/c_tests/test_gcc.vader')
-rw-r--r-- | test/c_tests/test_gcc.vader | 53 |
1 files changed, 40 insertions, 13 deletions
diff --git a/test/c_tests/test_gcc.vader b/test/c_tests/test_gcc.vader index 67e4e426..0bf3eb1d 100644 --- a/test/c_tests/test_gcc.vader +++ b/test/c_tests/test_gcc.vader @@ -34,12 +34,9 @@ Given c (A test C file): Execute(Basic errors should be returned for GCC for C files): call ale#Lint() - AssertEqual [{ - \ 'lnum': 3, - \ 'col': 1, - \ }], - \ map(getloclist(0), '{''lnum'': v:val.lnum, ''col'': v:val.col}'), - \ 'No errors returned! Got: ' . GetCommandOutput() + AssertEqual + \ [{'lnum': 3, 'col': 1}], + \ map(getloclist(0), '{''lnum'': v:val.lnum, ''col'': v:val.col}') Assert match(getloclist(0)[0].text, '\v^expected .*;.* before .*\}.* token$') >= 0, \ 'Invalid error text: ' . getloclist(0)[0].text @@ -52,12 +49,42 @@ Given cpp (A test C++ file): Execute(Basic errors should be returned for GCC for C++ files): call ale#Lint() - AssertEqual [{ - \ 'lnum': 3, - \ 'col': 1, - \ }], - \ map(getloclist(0), '{''lnum'': v:val.lnum, ''col'': v:val.col}'), - \ 'No errors returned! Got: ' . GetCommandOutput() + AssertEqual + \ [{'lnum': 3, 'col': 1}], + \ map(getloclist(0), '{''lnum'': v:val.lnum, ''col'': v:val.col}') Assert match(getloclist(0)[0].text, '\v^expected .*;.* before .*\}.* token$') >= 0, - \ 'Invalid error text: ' . getloclist(0)[0].text + +Given c (A test C file with a header containing broken code): + // Some comment line + #include "broken.h" + + int main() { + return 0 + } + +Execute(Basic errors should be returned for GCC for C files with headers): + call ale#Lint() + + AssertEqual + \ [{'lnum': 2, 'col': 0}], + \ map(getloclist(0), '{''lnum'': v:val.lnum, ''col'': v:val.col}') + + AssertEqual 'Problems were found in the header (See :ALEDetail)', getloclist(0)[0].text + +Given cpp (A test C++ file with a header containing broken code): + // Some comment line + #include "broken.h" + + int main() { + return 0 + } + +Execute(Basic errors should be returned for GCC for C++ files with headers): + call ale#Lint() + + AssertEqual + \ [{'lnum': 2, 'col': 0}], + \ map(getloclist(0), '{''lnum'': v:val.lnum, ''col'': v:val.col}') + + AssertEqual 'Problems were found in the header (See :ALEDetail)', getloclist(0)[0].text |