This repository has been archived on 2024-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
ale/test/test_ale_init_au_groups.vader

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')