diff options
Diffstat (limited to 'test/c_tests')
-rw-r--r-- | test/c_tests/broken.h | 1 | ||||
-rw-r--r-- | test/c_tests/test_gcc.vader | 53 |
2 files changed, 41 insertions, 13 deletions
diff --git a/test/c_tests/broken.h b/test/c_tests/broken.h new file mode 100644 index 00000000..3bd3571a --- /dev/null +++ b/test/c_tests/broken.h @@ -0,0 +1 @@ +{{{ 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 |