2017-03-30 22:21:37 +00:00
|
|
|
Before:
|
2017-04-03 18:04:02 +00:00
|
|
|
function! CheckAutocmd(group)
|
|
|
|
call ALEInitAuGroups()
|
|
|
|
redir => l:output
|
|
|
|
execute 'silent autocmd ' . a:group
|
|
|
|
redir END
|
|
|
|
|
|
|
|
return map(
|
|
|
|
\ filter(split(l:output, "\n"), 'v:val =~# ''^ALE'''),
|
|
|
|
\ 'split(v:val)[1]'
|
|
|
|
\)
|
|
|
|
endfunction
|
|
|
|
|
2017-03-30 22:21:37 +00:00
|
|
|
Save g:ale_lint_on_text_changed
|
|
|
|
Save g:ale_lint_on_insert_leave
|
|
|
|
|
|
|
|
After:
|
2017-04-03 18:04:02 +00:00
|
|
|
delfunction CheckAutocmd
|
|
|
|
Restore
|
2017-03-30 22:21:37 +00:00
|
|
|
|
|
|
|
call ALEInitAuGroups()
|
|
|
|
|
2017-04-03 18:04:02 +00:00
|
|
|
Execute (g:ale_lint_on_text_changed = 0 should bind no events):
|
|
|
|
let g:ale_lint_on_text_changed = 0
|
2017-03-30 22:21:37 +00:00
|
|
|
|
2017-04-03 18:04:02 +00:00
|
|
|
AssertEqual [], CheckAutocmd('ALERunOnTextChangedGroup')
|
2017-03-30 22:21:37 +00:00
|
|
|
|
2017-04-03 18:04:02 +00:00
|
|
|
Execute (g:ale_lint_on_text_changed = 1 bind both events):
|
|
|
|
let g:ale_lint_on_text_changed = 1
|
2017-03-30 22:21:37 +00:00
|
|
|
|
2017-04-03 18:04:02 +00:00
|
|
|
AssertEqual ['TextChanged', 'TextChangedI'], CheckAutocmd('ALERunOnTextChangedGroup')
|
|
|
|
|
|
|
|
Execute (g:ale_lint_on_text_changed = 'always' should bind both events):
|
2017-03-30 22:21:37 +00:00
|
|
|
let g:ale_lint_on_text_changed = 'always'
|
|
|
|
|
2017-04-03 18:04:02 +00:00
|
|
|
AssertEqual ['TextChanged', 'TextChangedI'], CheckAutocmd('ALERunOnTextChangedGroup')
|
2017-03-30 22:21:37 +00:00
|
|
|
|
2017-04-03 18:04:02 +00:00
|
|
|
Execute (g:ale_lint_on_text_changed = 'normal' should bind only TextChanged):
|
|
|
|
let g:ale_lint_on_text_changed = 'normal'
|
2017-03-30 22:21:37 +00:00
|
|
|
|
2017-04-03 18:04:02 +00:00
|
|
|
AssertEqual ['TextChanged'], CheckAutocmd('ALERunOnTextChangedGroup')
|
2017-03-30 22:21:37 +00:00
|
|
|
|
2017-04-03 18:04:02 +00:00
|
|
|
Execute (g:ale_lint_on_text_changed = 'insert' should bind only TextChangedI):
|
|
|
|
let g:ale_lint_on_text_changed = 'insert'
|
|
|
|
|
|
|
|
AssertEqual ['TextChangedI'], CheckAutocmd('ALERunOnTextChangedGroup')
|
|
|
|
|
|
|
|
Execute (g:ale_lint_on_insert_leave = 1 should bind InsertLeave):
|
2017-03-30 22:21:37 +00:00
|
|
|
let g:ale_lint_on_insert_leave = 1
|
|
|
|
|
2017-04-03 18:04:02 +00:00
|
|
|
AssertEqual ['InsertLeave'], CheckAutocmd('ALERunOnInsertLeave')
|
|
|
|
|
|
|
|
Execute (g:ale_lint_on_insert_leave = 0 should bind no events):
|
|
|
|
let g:ale_lint_on_insert_leave = 0
|
2017-03-30 22:21:37 +00:00
|
|
|
|
2017-04-03 18:04:02 +00:00
|
|
|
AssertEqual [], CheckAutocmd('ALERunOnInsertLeave')
|