summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-10-29 17:03:29 +0000
committerw0rp <devw0rp@gmail.com>2017-10-29 17:03:29 +0000
commitdaecbad543c68de1c0a2d8c368e4edde2f90461e (patch)
tree07ef88ce52d7bc006f8f006add1468c18eea0ce5 /test
parent1aa737cdc9b6e92b51823df93f356b4ec37beab3 (diff)
downloadale-daecbad543c68de1c0a2d8c368e4edde2f90461e.zip
Fix #719 - Add ALEReset and ALEResetBuffer for removing problems for all buffers or one buffer
Diffstat (limited to 'test')
-rw-r--r--test/test_ale_toggle.vader49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/test_ale_toggle.vader b/test/test_ale_toggle.vader
index d8de398a..c3bd2f52 100644
--- a/test/test_ale_toggle.vader
+++ b/test/test_ale_toggle.vader
@@ -215,6 +215,30 @@ Execute(ALEEnable should enable ALE and lint again):
AssertEqual g:expected_loclist, getloclist(0)
AssertEqual 1, g:ale_enabled
+Execute(ALEReset should reset everything for a buffer):
+ AssertEqual 'foobar', &filetype
+
+ call ale#Lint()
+
+ " First check that everything is there...
+ AssertEqual g:expected_loclist, getloclist(0)
+ AssertEqual [0, [[2, 1000001, 'ALEErrorSign']]], ale#sign#FindCurrentSigns(bufnr('%'))
+ AssertEqual
+ \ [{'group': 'ALEError', 'pos1': [2, 3, 1]}],
+ \ map(getmatches(), '{''group'': v:val.group, ''pos1'': v:val.pos1}')
+ 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.
+ ALEReset
+
+ " Everything should be cleared.
+ 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 [0, []], ale#sign#FindCurrentSigns(bufnr('%')), 'The signs were not cleared'
+ AssertEqual [], getmatches(), 'The highlights were not cleared'
+
+ AssertEqual 1, g:ale_enabled
+
Execute(ALEToggleBuffer should reset everything and then run again):
" Run this test asynchrously.
let g:ale_run_synchronously = 0
@@ -285,3 +309,28 @@ Execute(ALEEnableBuffer should complain when ALE is disabled globally):
AssertEqual
\ 'ALE cannot be enabled locally when disabled globally',
\ join(split(g:output))
+
+Execute(ALEResetBuffer should reset everything for a buffer):
+ AssertEqual 'foobar', &filetype
+
+ call ale#Lint()
+
+ " First check that everything is there...
+ AssertEqual g:expected_loclist, getloclist(0)
+ AssertEqual [0, [[2, 1000001, 'ALEErrorSign']]], ale#sign#FindCurrentSigns(bufnr('%'))
+ AssertEqual
+ \ [{'group': 'ALEError', 'pos1': [2, 3, 1]}],
+ \ map(getmatches(), '{''group'': v:val.group, ''pos1'': v:val.pos1}')
+ 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.
+ ALEResetBuffer
+
+ " Everything should be cleared.
+ 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 [0, []], ale#sign#FindCurrentSigns(bufnr('%')), 'The signs were not cleared'
+ AssertEqual [], getmatches(), 'The highlights were not cleared'
+
+ AssertEqual 1, g:ale_enabled
+ AssertEqual 1, get(b:, 'ale_enabled', 1)