summaryrefslogtreecommitdiff
path: root/test/test_ale_toggle.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-08-13 22:27:01 +0100
committerw0rp <devw0rp@gmail.com>2017-08-13 22:27:01 +0100
commit79701f6f200489d0eef2ea6e91f7e46be012cdd3 (patch)
tree99e3b95b01e62ab2faafd30b30a2bd29c53d43d9 /test/test_ale_toggle.vader
parent2d02de33d4ac8b90437b13467956530b8df32bf1 (diff)
downloadale-79701f6f200489d0eef2ea6e91f7e46be012cdd3.zip
#653 Skip filetype keys in g:ale_buffer_info during cleanup
Diffstat (limited to 'test/test_ale_toggle.vader')
-rw-r--r--test/test_ale_toggle.vader53
1 files changed, 51 insertions, 2 deletions
diff --git a/test/test_ale_toggle.vader b/test/test_ale_toggle.vader
index 202d8a35..3dd8e028 100644
--- a/test/test_ale_toggle.vader
+++ b/test/test_ale_toggle.vader
@@ -1,4 +1,7 @@
Before:
+ Save g:ale_buffer_info
+
+ let g:ale_buffer_info = {}
let g:expected_loclist = [{
\ 'bufnr': bufnr('%'),
\ 'lnum': 2,
@@ -42,10 +45,11 @@ 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.
+ " We don't care about some groups here.
if !empty(l:match)
\&& l:match[0] !=# 'ALECompletionGroup'
\&& l:match[0] !=# 'ALEBufferFixGroup'
+ \&& l:match[0] !=# 'ALEPatternOptionsGroup'
call add(l:results, l:match[0])
endif
endfor
@@ -64,10 +68,11 @@ Before:
\})
After:
+ Restore
+
unlet! g:expected_loclist
unlet! g:expected_groups
- let g:ale_buffer_info = {}
call ale#linter#Reset()
" Toggle ALE back on if we fail when it's disabled.
@@ -119,3 +124,47 @@ Execute(ALEToggle should reset everything and then run again):
\ 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
+
+Execute(ALEToggle should skip filename keys and preserve them):
+ AssertEqual 'foobar', &filetype
+
+ let g:ale_buffer_info['/foo/bar/baz.txt'] = {
+ \ 'job_list': [],
+ \ 'active_linter_list': [],
+ \ 'loclist': [],
+ \ 'temporary_file_list': [],
+ \ 'temporary_directory_list': [],
+ \ 'history': [],
+ \}
+
+ call ale#Lint()
+ call ale#engine#WaitForJobs(2000)
+
+ " Now Toggle ALE off.
+ ALEToggle
+
+ AssertEqual
+ \ {
+ \ 'job_list': [],
+ \ 'active_linter_list': [],
+ \ 'loclist': [],
+ \ 'temporary_file_list': [],
+ \ 'temporary_directory_list': [],
+ \ 'history': [],
+ \ },
+ \ get(g:ale_buffer_info, '/foo/bar/baz.txt', {})
+
+ " Toggle ALE on again.
+ ALEToggle
+ call ale#engine#WaitForJobs(2000)
+
+ AssertEqual
+ \ {
+ \ 'job_list': [],
+ \ 'active_linter_list': [],
+ \ 'loclist': [],
+ \ 'temporary_file_list': [],
+ \ 'temporary_directory_list': [],
+ \ 'history': [],
+ \ },
+ \ get(g:ale_buffer_info, '/foo/bar/baz.txt', {})