2017-09-03 17:24:43 +00:00
|
|
|
Before:
|
2018-04-12 19:31:33 +00:00
|
|
|
Save g:ale_filetype_blacklist
|
|
|
|
Save g:ale_maximum_file_size
|
|
|
|
Save g:ale_enabled
|
2017-09-03 17:24:43 +00:00
|
|
|
Save &l:statusline
|
|
|
|
|
2018-09-03 12:59:56 +00:00
|
|
|
let b:fake_mode = 'n'
|
|
|
|
|
2017-10-26 19:29:23 +00:00
|
|
|
call ale#test#SetDirectory('/testplugin/test')
|
|
|
|
|
2017-10-14 16:24:29 +00:00
|
|
|
let b:funky_command_created = 0
|
|
|
|
|
2018-09-03 12:59:56 +00:00
|
|
|
runtime autoload/ale/util.vim
|
|
|
|
|
|
|
|
function! ale#util#Mode(...) abort
|
|
|
|
return b:fake_mode
|
|
|
|
endfunction
|
|
|
|
|
2017-10-14 16:24:29 +00:00
|
|
|
" We will test for the existence of this command, so create one if needed.
|
|
|
|
if !exists(':CtrlPFunky')
|
|
|
|
command CtrlPFunky echo
|
|
|
|
let b:funky_command_created = 1
|
|
|
|
endif
|
|
|
|
|
2017-09-03 17:24:43 +00:00
|
|
|
After:
|
2018-04-12 19:31:33 +00:00
|
|
|
Restore
|
|
|
|
|
2017-10-26 19:29:23 +00:00
|
|
|
call ale#test#RestoreDirectory()
|
|
|
|
|
2017-10-14 16:24:29 +00:00
|
|
|
if b:funky_command_created
|
|
|
|
delcommand CtrlPFunky
|
|
|
|
let b:funky_command_created = 0
|
|
|
|
endif
|
|
|
|
|
2017-10-14 16:27:05 +00:00
|
|
|
unlet! b:funky_command_created
|
2018-09-03 12:59:56 +00:00
|
|
|
unlet! b:fake_mode
|
|
|
|
|
2019-04-08 12:42:09 +00:00
|
|
|
if &diff is 1
|
|
|
|
let &diff = 0
|
|
|
|
endif
|
|
|
|
|
2018-09-03 12:59:56 +00:00
|
|
|
runtime autoload/ale/util.vim
|
2017-10-14 16:27:05 +00:00
|
|
|
|
2018-05-28 16:38:14 +00:00
|
|
|
Given foobar(An empty file):
|
2017-09-03 17:24:43 +00:00
|
|
|
Execute(ALE shouldn't do much of anything for ctrlp-funky buffers):
|
|
|
|
Assert !ale#ShouldDoNothing(bufnr('')), 'The preliminary check failed'
|
|
|
|
|
|
|
|
let &l:statusline = '%#CtrlPMode2# prt %*%#CtrlPMode1# line %* <mru>={%#CtrlPMode1# funky %*}=<fil> <-> %=%<%#CtrlPMode2# %{getcwd()} %*'
|
|
|
|
|
|
|
|
Assert ale#ShouldDoNothing(bufnr(''))
|
2017-10-26 19:29:23 +00:00
|
|
|
|
|
|
|
Execute(ALE shouldn't try to check buffers with '.' as the filename):
|
|
|
|
AssertEqual
|
|
|
|
\ 0,
|
|
|
|
\ ale#ShouldDoNothing(bufnr('')),
|
|
|
|
\ 'ShouldDoNothing() was 1 for some other reason'
|
|
|
|
|
|
|
|
silent! noautocmd file .
|
|
|
|
|
|
|
|
Assert ale#ShouldDoNothing(bufnr(''))
|
2018-04-12 19:31:33 +00:00
|
|
|
|
2018-09-03 12:59:56 +00:00
|
|
|
Execute(DoNothing should return 1 when the filetype is empty):
|
2018-05-28 16:38:14 +00:00
|
|
|
AssertEqual
|
|
|
|
\ 0,
|
|
|
|
\ ale#ShouldDoNothing(bufnr('')),
|
|
|
|
\ 'ShouldDoNothing() was 1 for some other reason'
|
|
|
|
|
|
|
|
set filetype=
|
|
|
|
|
|
|
|
AssertEqual 1, ale#ShouldDoNothing(bufnr(''))
|
|
|
|
|
2018-09-03 12:59:56 +00:00
|
|
|
Execute(DoNothing should return 1 when an operator is pending):
|
|
|
|
let b:fake_mode = 'no'
|
|
|
|
|
|
|
|
AssertEqual 1, ale#ShouldDoNothing(bufnr(''))
|
|
|
|
|
2019-04-08 12:42:09 +00:00
|
|
|
Execute(DoNothing should return 1 for diff buffers):
|
|
|
|
let &diff = 1
|
|
|
|
|
|
|
|
AssertEqual 1, ale#ShouldDoNothing(bufnr(''))
|
|
|
|
|
2018-04-12 19:31:33 +00:00
|
|
|
Execute(The DoNothing check should work if the ALE globals aren't defined):
|
|
|
|
unlet! g:ale_filetype_blacklist
|
|
|
|
unlet! g:ale_maximum_file_size
|
|
|
|
unlet! g:ale_enabled
|
|
|
|
|
|
|
|
" This shouldn't throw exceptions.
|
|
|
|
call ale#ShouldDoNothing(bufnr(''))
|