test: use termopen() instead of :terminal more (#26462)

This commit is contained in:
zeertzjq
2023-12-08 08:00:27 +08:00
committed by GitHub
parent 5e3c1b976a
commit 3bb5d2f219
7 changed files with 34 additions and 15 deletions

View File

@@ -676,7 +676,7 @@ describe('jobs', function()
on_stderr = function(chan, data, name) stderr = data end,
on_stdout = function(chan, data, name) stdout = data end,
}
local j1 = vim.fn.jobstart({ vim.v.progpath, '-es', '-V1',( '+echo "%s="..getenv("%s")'):format(envname, envname), '+qa!' }, opt)
local j1 = vim.fn.jobstart({ vim.v.progpath, '-es', '-V1',('+echo "%s="..getenv("%s")'):format(envname, envname), '+qa!' }, opt)
vim.fn.jobwait({ j1 }, 10000)
return join({ join(stdout), join(stderr) })
]],
@@ -1162,11 +1162,12 @@ describe("pty process teardown", function()
it("does not prevent/delay exit. #4798 #4900", function()
skip(is_os('win'))
-- Use a nested nvim (in :term) to test without --headless.
feed_command(":terminal '"..helpers.nvim_prog
.."' -u NONE -i NONE --cmd '"..nvim_set.."' "
funcs.termopen({
helpers.nvim_prog, '-u', 'NONE', '-i', "NONE", '--cmd', nvim_set,
-- Use :term again in the _nested_ nvim to get a PTY process.
-- Use `sleep` to simulate a long-running child of the PTY.
.."+terminal +'!(sleep 300 &)' +qa")
'+terminal', '+!(sleep 300 &)', '+qa',
}, { env = { VIMRUNTIME = os.getenv('VIMRUNTIME') } })
-- Exiting should terminate all descendants (PTY, its children, ...).
screen:expect([[

View File

@@ -68,7 +68,9 @@ describe('command-line option', function()
-- Need to explicitly pipe to stdin so that the embedded Nvim instance doesn't try to read
-- data from the terminal #18181
funcs.termopen(string.format([[echo "" | %s]], table.concat(args, " ")))
funcs.termopen(string.format([[echo "" | %s]], table.concat(args, " ")), {
env = { VIMRUNTIME = os.getenv('VIMRUNTIME') }
})
screen:expect([[
{1:^ }|
{2:~ }|