mirror of
https://github.com/neovim/neovim.git
synced 2025-09-13 23:08:16 +00:00
win: enable job tests that use jobstart only
- echo "" does not hang in powershell - cmd.exe's echo command does not hang. - job tests default to powershell (WHY?) - wait 5 seconds for powershell to create an empty file - powershell is slow - cannot reliably validate the id returned by jobstart via jobpid, jobstop - if using cmd.exe, waiting for a second should be enough - remaining job tests are unreliable in Windows because any build can pass/fail for same conditions without changes, especially if the error is in stderr
This commit is contained in:
@@ -60,7 +60,7 @@ describe('jobs', function()
|
||||
it('changes to given / directory', function()
|
||||
nvim('command', "let g:job_opts.cwd = '/'")
|
||||
if iswin() then
|
||||
nvim('command', "let j = jobstart('pwd|%{$_.Path}', g:job_opts)")
|
||||
nvim('command', "let j = jobstart('(Get-Location).Path', g:job_opts)")
|
||||
else
|
||||
nvim('command', "let j = jobstart('pwd', g:job_opts)")
|
||||
end
|
||||
@@ -75,7 +75,7 @@ describe('jobs', function()
|
||||
mkdir(dir)
|
||||
nvim('command', "let g:job_opts.cwd = '" .. dir .. "'")
|
||||
if iswin() then
|
||||
nvim('command', "let j = jobstart('pwd|%{$_.Path}', g:job_opts)")
|
||||
nvim('command', "let j = jobstart('(Get-Location).Path', g:job_opts)")
|
||||
else
|
||||
nvim('command', "let j = jobstart('pwd', g:job_opts)")
|
||||
end
|
||||
@@ -115,13 +115,13 @@ describe('jobs', function()
|
||||
end)
|
||||
|
||||
it('returns -1 when target is not executable #5465', function()
|
||||
if helpers.pending_win32(pending) then return end
|
||||
local function new_job()
|
||||
return eval([[jobstart('')]])
|
||||
end
|
||||
local executable_jobid = new_job()
|
||||
local nonexecutable_jobid = eval(
|
||||
"jobstart(['./test/functional/fixtures/non_executable.txt'])")
|
||||
local nonexecutable_jobid = eval("jobstart(['"..(iswin()
|
||||
and './test/functional/fixtures'
|
||||
or './test/functional/fixtures/non_executable.txt').."'])")
|
||||
eq(-1, nonexecutable_jobid)
|
||||
-- Should _not_ throw an error.
|
||||
eq("", eval("v:errmsg"))
|
||||
@@ -133,11 +133,10 @@ describe('jobs', function()
|
||||
-- TODO: hangs on Windows
|
||||
if helpers.pending_win32(pending) then return end
|
||||
nvim('command', "let g:job_opts.on_stderr = function('OnEvent')")
|
||||
nvim('command', "call jobstart('echo', g:job_opts)")
|
||||
nvim('command', [[call jobstart('echo ""', g:job_opts)]])
|
||||
expect_twostreams({{'notification', 'stdout', {0, {'', ''}}},
|
||||
{'notification', 'stdout', {0, {''}}}},
|
||||
{{'notification', 'stderr', {0, {''}}}})
|
||||
|
||||
eq({'notification', 'exit', {0, 0}}, next_msg())
|
||||
end)
|
||||
|
||||
@@ -253,7 +252,6 @@ describe('jobs', function()
|
||||
end)
|
||||
|
||||
it('will not leak memory if we leave a job running', function()
|
||||
if helpers.pending_win32(pending) then return end -- TODO: Need `cat`.
|
||||
nvim('command', "call jobstart(['cat', '-'], g:job_opts)")
|
||||
end)
|
||||
|
||||
@@ -300,11 +298,7 @@ describe('jobs', function()
|
||||
end)
|
||||
|
||||
it('can omit options', function()
|
||||
if helpers.pending_win32(pending) then return end
|
||||
neq(0, nvim('eval', 'delete(".Xtestjob")'))
|
||||
nvim('command', "call jobstart(['touch', '.Xtestjob'])")
|
||||
nvim('command', "sleep 100m")
|
||||
eq(0, nvim('eval', 'delete(".Xtestjob")'))
|
||||
ok(eval([[jobstart('echo ""')]]) > 0)
|
||||
end)
|
||||
|
||||
it('can omit data callbacks', function()
|
||||
@@ -348,7 +342,6 @@ describe('jobs', function()
|
||||
end)
|
||||
|
||||
it('can redefine callbacks being used by a job', function()
|
||||
if helpers.pending_win32(pending) then return end -- TODO: Need `cat`.
|
||||
local screen = Screen.new()
|
||||
screen:attach()
|
||||
screen:set_default_attr_ids({
|
||||
@@ -363,7 +356,7 @@ describe('jobs', function()
|
||||
\ 'on_stderr': function('g:JobHandler'),
|
||||
\ 'on_exit': function('g:JobHandler')
|
||||
\ }
|
||||
let job = jobstart('cat -', g:callbacks)
|
||||
let job = jobstart(['cat', '-'], g:callbacks)
|
||||
]])
|
||||
wait()
|
||||
source([[
|
||||
|
Reference in New Issue
Block a user