56 lines
1.6 KiB
Text
56 lines
1.6 KiB
Text
Before:
|
|
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
|
|
|
|
Save g:ale_lint_on_text_changed
|
|
Save g:ale_lint_on_insert_leave
|
|
|
|
After:
|
|
delfunction CheckAutocmd
|
|
Restore
|
|
|
|
call ALEInitAuGroups()
|
|
|
|
Execute (g:ale_lint_on_text_changed = 0 should bind no events):
|
|
let g:ale_lint_on_text_changed = 0
|
|
|
|
AssertEqual [], CheckAutocmd('ALERunOnTextChangedGroup')
|
|
|
|
Execute (g:ale_lint_on_text_changed = 1 bind both events):
|
|
let g:ale_lint_on_text_changed = 1
|
|
|
|
AssertEqual ['TextChanged', 'TextChangedI'], CheckAutocmd('ALERunOnTextChangedGroup')
|
|
|
|
Execute (g:ale_lint_on_text_changed = 'always' should bind both events):
|
|
let g:ale_lint_on_text_changed = 'always'
|
|
|
|
AssertEqual ['TextChanged', 'TextChangedI'], CheckAutocmd('ALERunOnTextChangedGroup')
|
|
|
|
Execute (g:ale_lint_on_text_changed = 'normal' should bind only TextChanged):
|
|
let g:ale_lint_on_text_changed = 'normal'
|
|
|
|
AssertEqual ['TextChanged'], CheckAutocmd('ALERunOnTextChangedGroup')
|
|
|
|
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):
|
|
let g:ale_lint_on_insert_leave = 1
|
|
|
|
AssertEqual ['InsertLeave'], CheckAutocmd('ALERunOnInsertLeave')
|
|
|
|
Execute (g:ale_lint_on_insert_leave = 0 should bind no events):
|
|
let g:ale_lint_on_insert_leave = 0
|
|
|
|
AssertEqual [], CheckAutocmd('ALERunOnInsertLeave')
|