spacevim/bundle/neomake/tests/action_queue.vader
JIe 2bb7059579
Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
init
2024-08-21 14:17:26 +08:00

240 lines
8.3 KiB
Plaintext

Include: include/setup.vader
Execute (action queue: order on WinEnter):
function! F1(...)
return neomake#action_queue#add(['Timer', 'WinEnter'], [function('F1'),
\ a:000])
endfunction
function! F2(...)
return neomake#action_queue#add(['WinEnter'], [function('F2'),
\ a:000])
endfunction
let jobinfo = NeomakeTestsFakeJobinfo()
call neomake#action_queue#add(['Timer', 'WinEnter'], [function('F1'), [jobinfo]])
call neomake#action_queue#add(['WinEnter'], [function('F2'), [jobinfo]])
doautocmd WinEnter
AssertNeomakeMessage 'action queue: processing for WinEnter (2 items).', 3, {'winnr': 1}
AssertNeomakeMessage 'action queue: calling F1.', 3
call neomake#action_queue#clean(jobinfo)
delfunction F1
delfunction F2
Execute (action queue: order on WinEnter with Timer):
let s:calls = [0, 0]
function! F1(...)
let s:calls[0] += 1
" NOTE: copies a:000 to work around https://github.com/neovim/neovim/issues/9169.
return neomake#action_queue#add(['Timer', 'WinEnter'], [function('F1'),
\ copy(a:000)])
endfunction
function! F2(...)
let s:calls[1] += 1
" NOTE: copies a:000 to work around https://github.com/neovim/neovim/issues/9169.
return neomake#action_queue#add(['WinEnter'], [function('F2'),
\ copy(a:000)])
endfunction
let jobinfo = NeomakeTestsFakeJobinfo()
call neomake#action_queue#add(['Timer', 'WinEnter'], [function('F1'), [jobinfo]])
call neomake#action_queue#add(['WinEnter'], [function('F2'), [jobinfo]])
if has('timers')
AssertNeomakeMessage '\V\^Retrying Timer event in 10ms'
NeomakeTestsWaitForMessage 'action queue: processing for Timer (1 items).', 3, {'winnr': 1}
else
doautocmd CursorHold
AssertNeomakeMessage 'action queue: processing for Timer (1 items).', 3, {'winnr': 1}
endif
AssertNeomakeMessage 'Queuing action F1 for Timer, WinEnter.'
AssertNeomakeMessage 'action queue: re-queuing F2 for not processed make_id.', 3
doautocmd WinEnter
AssertNeomakeMessage 'action queue: processing for WinEnter (2 items).', 3, {'winnr': 1}
AssertNeomakeMessage 'action queue: calling F1.', 3
AssertNeomakeMessage 'action queue: re-queuing F2 for not processed make_id.', 3
call neomake#action_queue#clean(jobinfo)
delfunction F1
delfunction F2
AssertEqual s:calls, [2, 0]
Execute (action queue: re-queued with different events):
let s:calls = [0, 0]
function! F1(...)
let s:calls[0] += 1
if s:calls[0] == 2
return g:neomake#action_queue#processed
endif
" NOTE: copies a:000 to work around https://github.com/neovim/neovim/issues/9169.
return neomake#action_queue#add(['BufEnter', 'WinEnter'], [function('F1'),
\ copy(a:000)])
endfunction
function! F2(...)
let s:calls[1] += 1
if s:calls[1] == 2
return g:neomake#action_queue#processed
endif
" NOTE: copies a:000 to work around https://github.com/neovim/neovim/issues/9169.
return neomake#action_queue#add(['WinEnter'], [function('F2'),
\ copy(a:000)])
endfunction
let jobinfo = NeomakeTestsFakeJobinfo()
call neomake#action_queue#add(['Timer', 'WinEnter'], [function('F1'), [jobinfo]])
call neomake#action_queue#add(['WinEnter'], [function('F2'), [jobinfo]])
if has('timers')
AssertNeomakeMessage '\V\^Retrying Timer event in 10ms'
else
doautocmd CursorHold
endif
NeomakeTestsWaitForMessage 'action queue: processing for Timer (1 items).', 3, {'winnr': 1}
AssertNeomakeMessage 'Queuing action F1 for BufEnter, WinEnter.'
AssertNeomakeMessage 'action queue: re-queuing F2 for not processed make_id.', 3
AssertEqual s:calls, [1, 0]
doautocmd WinEnter
AssertEqual s:calls, [2, 1]
AssertNeomakeMessage 'action queue: processing for WinEnter (2 items).', 3, {'winnr': 1}
AssertNeomakeMessage 'action queue: calling F1.', 3
AssertNeomakeMessage 'action queue: calling F2.', 3
AssertNeomakeMessage 'Queuing action F2 for WinEnter.', 3
AssertEqual s:calls, [2, 1]
AssertEqual len(g:neomake#action_queue#_s.action_queue), 1
doautocmd WinEnter
AssertEqual len(g:neomake#action_queue#_s.action_queue), 0
delfunction F1
delfunction F2
AssertEqual s:calls, [2, 2]
Execute (action queue: logs errors (get_list_entries, WinEnter)):
function! F1(jobinfo,...)
if a:0
return g:neomake#action_queue#processed
endif
throw 'error_in_F1'
endfunction
let jobinfo = NeomakeTestsFakeJobinfo()
call neomake#action_queue#add(['Timer', 'WinEnter'], [function('F1'), [jobinfo]])
doautocmd WinEnter
AssertNeomakeMessage 'action queue: processing for WinEnter (1 items).', 3, {'winnr': 1}
AssertNeomakeMessage 'action queue: calling F1.', 3
AssertNeomakeMessage 'Error during action queue processing: error_in_F1.', 0
AssertNeomakeMessage '\v^CancelJob: job not found: \d+.', 0
call neomake#action_queue#clean(jobinfo)
delfunction F1
Execute (action queue: logs errors (get_list_entries, Timer)):
function! F1(jobinfo,...)
if a:0
return g:neomake#action_queue#processed
endif
throw 'error_in_F1'
endfunction
let jobinfo = NeomakeTestsFakeJobinfo()
call neomake#action_queue#add(['Timer', 'WinEnter'], [function('F1'), [jobinfo]])
if has('timers')
NeomakeTestsWaitForMessage 'action queue: processing for Timer (1 items).', 3, {'winnr': 1}
else
doautocmd CursorHold
endif
AssertNeomakeMessage 'action queue: calling F1.', 3
AssertNeomakeMessage 'Error during action queue processing: error_in_F1.', 0
AssertNeomakeMessage '\v^CancelJob: job not found: \d+.', 0
call neomake#action_queue#clean(jobinfo)
delfunction F1
Execute (action queue: logs errors (E48, WinEnter)):
function! F1(jobinfo,...)
if a:0
return g:neomake#action_queue#processed
endif
sandbox bprevious
endfunction
let jobinfo = NeomakeTestsFakeJobinfo()
call neomake#action_queue#add(['Timer', 'WinEnter'], [function('F1'), [jobinfo]])
doautocmd WinEnter
AssertNeomakeMessage 'action queue: processing for WinEnter (1 items).', 3, {'winnr': 1}
AssertNeomakeMessage 'action queue: calling F1.', 3
AssertNeomakeMessage '\vError during action queue processing: .*E48'
AssertNeomakeMessage '\v^CancelJob: job not found: \d+.', 0
call neomake#action_queue#clean(jobinfo)
delfunction F1
Execute (action queue: handles make_info in clean_make_info queue check):
if !neomake#has_async_support() || !has('patch-v8.1.0342')
NeomakeTestsSkip 'no async support.'
else
new
call neomake#Make({'enabled_makers': [g:true_maker]})
let make_info = values(neomake#GetStatus().make_info)[0]
function F(...)
return g:neomake#action_queue#processed
endfunction
call neomake#action_queue#add(['InsertLeave'], [function('F'), [make_info]])
NeomakeTestsWaitForFinishedJobs
AssertNeomakeMessage '\VQueuing clean_make_info for already queued actions: [''make \d\+'']', 3
AssertNeomakeMessage 'Queuing action clean_make_info for any event.', 3
AssertNeomakeMessage 'Skipping cleaning of make info for queued actions.', 3
doautocmd InsertLeave
AssertNeomakeMessage 'action queue: calling F.'
AssertNeomakeMessage 'action queue: calling clean_make_info.'
bwipe
delfunction F
endif
Execute (action queue: skips processing during internal autocommands):
if NeomakeAsyncTestsSetup()
Save g:neomake_open_list
let g:neomake_open_list = 2
new
let s:calls = []
function! F(...)
call add(s:calls, a:000)
return g:neomake#action_queue#processed
endfunction
let jobinfo = NeomakeTestsFakeJobinfo()
call neomake#action_queue#add(['WinEnter'], [function('F'), [jobinfo]])
call neomake#Make(1, [g:error_maker])
let job = neomake#GetJobs()[-1]
NeomakeTestsWaitForFinishedJobs
AssertNeomakeMessage 'Handling location list: executing lwindow.', 3, job
AssertNeomakeMessage 'action queue: skip processing for WinEnter (ignore_autocommands=1).', 3
AssertNeomakeMessage 'list window has been opened (old count: 2, new count: 3, height: 1).', 3
AssertNeomakeMessage 'action queue: skip processing for WinEnter (ignore_autocommands=1).', 3
AssertNeomakeMessage 'action queue: skip processing for WinEnter (ignore_autocommands=1).', 3
lclose
wincmd p
AssertNeomakeMessage '\vaction queue: processing for WinEnter'
wincmd p
bwipe
delfunction F
endif