mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
test(core/startup_spec): use retry() instead of jobwait()
This should work on Windows.
(cherry picked from commit 9ade0702b6
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
76bbfb3cfd
commit
d1a7aaa7f2
@@ -9,6 +9,7 @@ local ok = helpers.ok
|
|||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local matches = helpers.matches
|
local matches = helpers.matches
|
||||||
local eval = helpers.eval
|
local eval = helpers.eval
|
||||||
|
local exec = helpers.exec
|
||||||
local exec_capture = helpers.exec_capture
|
local exec_capture = helpers.exec_capture
|
||||||
local exec_lua = helpers.exec_lua
|
local exec_lua = helpers.exec_lua
|
||||||
local feed = helpers.feed
|
local feed = helpers.feed
|
||||||
@@ -21,7 +22,6 @@ local nvim_set = helpers.nvim_set
|
|||||||
local read_file = helpers.read_file
|
local read_file = helpers.read_file
|
||||||
local retry = helpers.retry
|
local retry = helpers.retry
|
||||||
local rmdir = helpers.rmdir
|
local rmdir = helpers.rmdir
|
||||||
local skip = helpers.skip
|
|
||||||
local sleep = helpers.sleep
|
local sleep = helpers.sleep
|
||||||
local startswith = helpers.startswith
|
local startswith = helpers.startswith
|
||||||
local write_file = helpers.write_file
|
local write_file = helpers.write_file
|
||||||
@@ -435,15 +435,23 @@ describe('startup', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('-r works without --headless in PTY #23294', function()
|
it('-r works without --headless in PTY #23294', function()
|
||||||
skip(is_os('win'))
|
exec([[
|
||||||
eq({ 0 }, exec_lua([[return vim.fn.jobwait({ vim.fn.jobstart({...}, {
|
func Normalize(data) abort
|
||||||
pty = true,
|
" Windows: remove ^M and term escape sequences
|
||||||
stdout_buffered = true,
|
return map(a:data, 'substitute(substitute(v:val, "\r", "", "g"), "\x1b\\%(\\]\\d\\+;.\\{-}\x07\\|\\[.\\{-}[\x40-\x7E]\\)", "", "g")')
|
||||||
on_stdout = function(_, data, _)
|
endfunc
|
||||||
_G.Recovery_stdout = data
|
func OnOutput(id, data, event) dict
|
||||||
end,
|
let g:stdout = Normalize(a:data)
|
||||||
}) })]], nvim_prog, '-u', 'NONE', '-i', 'NONE', '-r'))
|
endfunc
|
||||||
matches('Swap files found:\r*', exec_lua('return _G.Recovery_stdout[1]'))
|
call jobstart([v:progpath, '-u', 'NONE', '-i', 'NONE', '-r'], {
|
||||||
|
\ 'pty': v:true,
|
||||||
|
\ 'stdout_buffered': v:true,
|
||||||
|
\ 'on_stdout': function('OnOutput'),
|
||||||
|
\ })
|
||||||
|
]])
|
||||||
|
retry(nil, nil, function()
|
||||||
|
eq('Swap files found:', eval('g:stdout[0]'))
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('fixed hang issue with --headless (#11386)', function()
|
it('fixed hang issue with --headless (#11386)', function()
|
||||||
|
Reference in New Issue
Block a user