summaryrefslogtreecommitdiff
path: root/test/test_ale_toggle.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-07-07 23:47:41 +0100
committerw0rp <devw0rp@gmail.com>2017-07-07 23:47:41 +0100
commit8eb4f95766350b7a1f80eae691f390faee045e6d (patch)
tree8d3973d0226c83d129fa8c2292befb5adf601759 /test/test_ale_toggle.vader
parent46225f3bb13a242bf3b218d395f3911f013d5f14 (diff)
downloadale-8eb4f95766350b7a1f80eae691f390faee045e6d.zip
#697 - Clear all highlights every time items are set again, and refactor most things. Clear errors when linters are removed
Diffstat (limited to 'test/test_ale_toggle.vader')
-rw-r--r--test/test_ale_toggle.vader15
1 files changed, 10 insertions, 5 deletions
diff --git a/test/test_ale_toggle.vader b/test/test_ale_toggle.vader
index 3546ad71..202d8a35 100644
--- a/test/test_ale_toggle.vader
+++ b/test/test_ale_toggle.vader
@@ -11,7 +11,6 @@ Before:
\ 'valid': 1,
\}]
let g:expected_groups = [
- \ 'ALEBufferFixGroup',
\ 'ALECleanupGroup',
\ 'ALECursorGroup',
\ 'ALEHighlightBufferGroup',
@@ -43,7 +42,10 @@ Before:
for l:line in split(l:output, "\n")
let l:match = matchlist(l:line, '^ALE[a-zA-Z]\+Group')
+ " We don't care about checking for the completion or fixing groups here.
if !empty(l:match)
+ \&& l:match[0] !=# 'ALECompletionGroup'
+ \&& l:match[0] !=# 'ALEBufferFixGroup'
call add(l:results, l:match[0])
endif
endfor
@@ -94,15 +96,17 @@ Execute(ALEToggle should reset everything and then run again):
\ [{'group': 'ALEError', 'pos1': [2, 3, 1]}],
\ map(getmatches(), '{''group'': v:val.group, ''pos1'': v:val.pos1}')
AssertEqual g:expected_groups, ParseAuGroups()
+ AssertEqual [{'lnum': 2, 'bufnr': bufnr(''), 'col': 3, 'linter_name': 'testlinter', 'vcol': 0, 'nr': -1, 'type': 'E', 'text': 'foo bar', 'sign_id': 1000001}], g:ale_buffer_info[bufnr('')].loclist
" Now Toggle ALE off.
ALEToggle
" Everything should be cleared.
- AssertEqual [], getloclist(0)
- AssertEqual [], ale#sign#FindCurrentSigns(bufnr('%'))
- AssertEqual [], getmatches()
- AssertEqual ['ALEBufferFixGroup', 'ALECleanupGroup', 'ALEHighlightBufferGroup'], ParseAuGroups()
+ Assert !has_key(g:ale_buffer_info, bufnr('')), 'The g:ale_buffer_info Dictionary was not removed'
+ AssertEqual [], getloclist(0), 'The loclist was not cleared'
+ AssertEqual [], ale#sign#FindCurrentSigns(bufnr('%')), 'The signs were not cleared'
+ AssertEqual [], getmatches(), 'The highlights were not cleared'
+ AssertEqual ['ALECleanupGroup', 'ALEHighlightBufferGroup'], ParseAuGroups()
" Toggle ALE on, everything should be set up and run again.
ALEToggle
@@ -114,3 +118,4 @@ Execute(ALEToggle should reset everything and then run again):
\ [{'group': 'ALEError', 'pos1': [2, 3, 1]}],
\ map(getmatches(), '{''group'': v:val.group, ''pos1'': v:val.pos1}')
AssertEqual g:expected_groups, ParseAuGroups()
+ AssertEqual [{'lnum': 2, 'bufnr': bufnr(''), 'col': 3, 'linter_name': 'testlinter', 'vcol': 0, 'nr': -1, 'type': 'E', 'text': 'foo bar', 'sign_id': 1000001}], g:ale_buffer_info[bufnr('')].loclist