diff options
author | w0rp <devw0rp@gmail.com> | 2016-10-14 20:29:31 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2016-10-14 20:29:31 +0100 |
commit | 56b866c8d8c1dc9e236019a74d4baeafb3bbcb57 (patch) | |
tree | 1293ae9b5747b55d97235f554d48bf1d6874da6d /test/test_cursor_warnings.vader | |
parent | 1e756c0e24412e343674fe906c2deb6c9354a7c4 (diff) | |
download | ale-56b866c8d8c1dc9e236019a74d4baeafb3bbcb57.zip |
Add some tests for the EchoCursorWarning function.
Diffstat (limited to 'test/test_cursor_warnings.vader')
-rw-r--r-- | test/test_cursor_warnings.vader | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/test/test_cursor_warnings.vader b/test/test_cursor_warnings.vader new file mode 100644 index 00000000..364db4bc --- /dev/null +++ b/test/test_cursor_warnings.vader @@ -0,0 +1,84 @@ +Before: + let g:ale_buffer_loclist_map = { + \ bufnr('%'): [ + \ { + \ 'lnum': 1, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'linter_name': 'eslint', + \ 'nr': -1, + \ 'type': 'E', + \ 'col': 10, + \ 'text': 'Missing semicolon. (semi)' + \ }, + \ { + \ 'lnum': 2, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'linter_name': 'eslint', + \ 'nr': -1, + \ 'type': 'W', + \ 'col': 10, + \ 'text': 'Infix operators must be spaced. (space-infix-ops)' + \ }, + \ { + \ 'lnum': 2, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'linter_name': 'eslint', + \ 'nr': -1, + \ 'type': 'E', + \ 'col': 15, + \ 'text': 'Missing radix parameter (radix)' + \ } + \ ], + \} + +After: + unlet! g:output + unlet! g:lines + let g:ale_buffer_loclist_map = {} + +Given javascript(A Javscript file with warnings/errors): + var x = 3 + var x = 5*2 + parseInt("10"); + +Execute(Evaluate the cursor function at line 1): + :1 + call ale#cursor#EchoCursorWarning() + +Then(Check the cursor output): + redir => g:output + :mess + redir END + + let g:lines = split(g:output, "\n") + + AssertEqual 'Missing semicolon. (semi)', g:lines[-1] + +Execute(Evaluate the cursor function at line 2): + :2 + call ale#cursor#EchoCursorWarning() + +Then(Check the cursor output): + redir => g:output + :mess + redir END + + let g:lines = split(g:output, "\n") + + AssertEqual 'Infix operators must be spaced. (space-infix-ops)', g:lines[-1] + +Execute(Evaluate the cursor function later in line 2): + :2 + normal 16l + call ale#cursor#EchoCursorWarning() + +Then(Check the cursor output): + redir => g:output + :mess + redir END + + let g:lines = split(g:output, "\n") + + AssertEqual 'Missing radix parameter (radix)', g:lines[-1] |