aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2024-12-19 07:07:04 -0800
committerGitHub <noreply@github.com>2024-12-19 07:07:04 -0800
commit8ef41f590224dfeea2e51d9fec150e363fd72ee0 (patch)
tree2c9879066ef7e70dc1d178d46e2048bf1470f818 /test
parenta5a4149e9754a96c063a357c18397aa7906edf53 (diff)
downloadrneovim-8ef41f590224dfeea2e51d9fec150e363fd72ee0.tar.gz
rneovim-8ef41f590224dfeea2e51d9fec150e363fd72ee0.tar.bz2
rneovim-8ef41f590224dfeea2e51d9fec150e363fd72ee0.zip
feat(jobs): jobstart(…,{term=true}), deprecate termopen() #31343
Problem: `termopen` has long been a superficial wrapper around `jobstart`, and has no real purpose. Also, `vim.system` and `nvim_open_term` presumably will replace all features of `jobstart` and `termopen`, so centralizing the logic will help with that. Solution: - Introduce `eval/deprecated.c`, where all deprecated eval funcs will live. - Introduce "term" flag of `jobstart`. - Deprecate `termopen`.
Diffstat (limited to 'test')
-rw-r--r--test/functional/api/buffer_updates_spec.lua3
-rw-r--r--test/functional/api/vim_spec.lua3
-rw-r--r--test/functional/core/job_spec.lua47
-rw-r--r--test/functional/core/main_spec.lua3
-rw-r--r--test/functional/core/startup_spec.lua29
-rw-r--r--test/functional/editor/mode_normal_spec.lua8
-rw-r--r--test/functional/ex_cmds/swapfile_preserve_recover_spec.lua12
-rw-r--r--test/functional/legacy/window_cmd_spec.lua2
-rw-r--r--test/functional/terminal/buffer_spec.lua10
-rw-r--r--test/functional/terminal/channel_spec.lua14
-rw-r--r--test/functional/terminal/clipboard_spec.lua2
-rw-r--r--test/functional/terminal/cursor_spec.lua2
-rw-r--r--test/functional/terminal/ex_terminal_spec.lua4
-rw-r--r--test/functional/terminal/highlight_spec.lua11
-rw-r--r--test/functional/terminal/scrollback_spec.lua6
-rw-r--r--test/functional/terminal/tui_spec.lua6
-rw-r--r--test/functional/testterm.lua2
-rw-r--r--test/functional/ui/hlstate_spec.lua2
-rw-r--r--test/functional/ui/messages_spec.lua2
-rw-r--r--test/functional/ui/title_spec.lua2
-rw-r--r--test/old/testdir/runnvim.vim3
21 files changed, 113 insertions, 60 deletions
diff --git a/test/functional/api/buffer_updates_spec.lua b/test/functional/api/buffer_updates_spec.lua
index 527394bfd1..489f601d31 100644
--- a/test/functional/api/buffer_updates_spec.lua
+++ b/test/functional/api/buffer_updates_spec.lua
@@ -879,7 +879,8 @@ describe('API: buffer events:', function()
it('when :terminal lines change', function()
local buffer_lines = {}
local expected_lines = {}
- fn.termopen({ nvim_prog, '-u', 'NONE', '-i', 'NONE', '-n', '-c', 'set shortmess+=A' }, {
+ fn.jobstart({ nvim_prog, '-u', 'NONE', '-i', 'NONE', '-n', '-c', 'set shortmess+=A' }, {
+ term = true,
env = { VIMRUNTIME = os.getenv('VIMRUNTIME') },
})
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 130be9987f..fbc9490df6 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -2704,7 +2704,8 @@ describe('API', function()
-- :terminal with args + running process.
command('enew')
local progpath_esc = eval('shellescape(v:progpath)')
- fn.termopen(('%s -u NONE -i NONE'):format(progpath_esc), {
+ fn.jobstart(('%s -u NONE -i NONE'):format(progpath_esc), {
+ term = true,
env = { VIMRUNTIME = os.getenv('VIMRUNTIME') },
})
eq(-1, eval('jobwait([&channel], 0)[0]')) -- Running?
diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua
index b4d80d4ed4..952437d80e 100644
--- a/test/functional/core/job_spec.lua
+++ b/test/functional/core/job_spec.lua
@@ -65,6 +65,39 @@ describe('jobs', function()
]])
end)
+ it('validation', function()
+ matches(
+ "E475: Invalid argument: job cannot have both 'pty' and 'rpc' options set",
+ pcall_err(command, "call jobstart(['cat', '-'], { 'pty': v:true, 'rpc': v:true })")
+ )
+ matches(
+ 'E475: Invalid argument: expected valid directory',
+ pcall_err(command, "call jobstart(['cat', '-'], { 'cwd': 9313843 })")
+ )
+ matches(
+ 'E475: Invalid argument: expected valid directory',
+ pcall_err(command, "call jobstart(['cat', '-'], { 'cwd': 'bogusssssss/bogus' })")
+ )
+ matches(
+ "E475: Invalid argument: 'term' must be Boolean",
+ pcall_err(command, "call jobstart(['cat', '-'], { 'term': 'bogus' })")
+ )
+ matches(
+ "E475: Invalid argument: 'term' must be Boolean",
+ pcall_err(command, "call jobstart(['cat', '-'], { 'term': 1 })")
+ )
+ command('set modified')
+ matches(
+ vim.pesc('jobstart(...,{term=true}) requires unmodified buffer'),
+ pcall_err(command, "call jobstart(['cat', '-'], { 'term': v:true })")
+ )
+
+ -- Non-failure cases:
+ command('set nomodified')
+ command("call jobstart(['cat', '-'], { 'term': v:true })")
+ command("call jobstart(['cat', '-'], { 'term': v:false })")
+ end)
+
it('must specify env option as a dict', function()
command('let g:job_opts.env = v:true')
local _, err = pcall(function()
@@ -969,13 +1002,6 @@ describe('jobs', function()
eq({ 'notification', 'exit', { 0, 143 } }, next_msg())
end)
- it('cannot have both rpc and pty options', function()
- command('let g:job_opts.pty = v:true')
- command('let g:job_opts.rpc = v:true')
- local _, err = pcall(command, "let j = jobstart(['cat', '-'], g:job_opts)")
- matches("E475: Invalid argument: job cannot have both 'pty' and 'rpc' options set", err)
- end)
-
it('does not crash when repeatedly failing to start shell', function()
source([[
set shell=nosuchshell
@@ -1230,7 +1256,7 @@ describe('pty process teardown', function()
it('does not prevent/delay exit. #4798 #4900', function()
skip(fn.executable('sleep') == 0, 'missing "sleep" command')
-- Use a nested nvim (in :term) to test without --headless.
- fn.termopen({
+ fn.jobstart({
n.nvim_prog,
'-u',
'NONE',
@@ -1243,7 +1269,10 @@ describe('pty process teardown', function()
'+terminal',
'+!(sleep 300 &)',
'+qa',
- }, { env = { VIMRUNTIME = os.getenv('VIMRUNTIME') } })
+ }, {
+ term = true,
+ env = { VIMRUNTIME = os.getenv('VIMRUNTIME') },
+ })
-- Exiting should terminate all descendants (PTY, its children, ...).
screen:expect([[
diff --git a/test/functional/core/main_spec.lua b/test/functional/core/main_spec.lua
index bfa5a0eb6a..ce4ba1905f 100644
--- a/test/functional/core/main_spec.lua
+++ b/test/functional/core/main_spec.lua
@@ -103,7 +103,8 @@ 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
- fn.termopen(string.format([[echo "" | %s]], table.concat(args, ' ')), {
+ fn.jobstart(string.format([[echo "" | %s]], table.concat(args, ' ')), {
+ term = true,
env = { VIMRUNTIME = os.getenv('VIMRUNTIME') },
})
screen:expect(
diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua
index 319a037342..76b0755441 100644
--- a/test/functional/core/startup_spec.lua
+++ b/test/functional/core/startup_spec.lua
@@ -55,7 +55,10 @@ describe('startup', function()
clear()
local screen
screen = Screen.new(84, 3)
- fn.termopen({ nvim_prog, '-u', 'NONE', '--server', eval('v:servername'), '--remote-ui' })
+ fn.jobstart(
+ { nvim_prog, '-u', 'NONE', '--server', eval('v:servername'), '--remote-ui' },
+ { term = true }
+ )
screen:expect([[
^Cannot attach UI of :terminal child to its parent. (Unset $NVIM to skip this check) |
|*2
@@ -98,7 +101,7 @@ describe('startup', function()
screen = Screen.new(60, 7)
-- not the same colors on windows for some reason
screen._default_attr_ids = nil
- local id = fn.termopen({
+ local id = fn.jobstart({
nvim_prog,
'-u',
'NONE',
@@ -108,6 +111,7 @@ describe('startup', function()
'set noruler',
'-D',
}, {
+ term = true,
env = {
VIMRUNTIME = os.getenv('VIMRUNTIME'),
},
@@ -360,7 +364,7 @@ describe('startup', function()
command([[set shellcmdflag=/s\ /c shellxquote=\"]])
end
-- Running in :terminal
- fn.termopen({
+ fn.jobstart({
nvim_prog,
'-u',
'NONE',
@@ -371,6 +375,7 @@ describe('startup', function()
'-c',
'echo has("ttyin") has("ttyout")',
}, {
+ term = true,
env = {
VIMRUNTIME = os.getenv('VIMRUNTIME'),
},
@@ -393,13 +398,14 @@ describe('startup', function()
os.remove('Xtest_startup_ttyout')
end)
-- Running in :terminal
- fn.termopen(
+ fn.jobstart(
(
[["%s" -u NONE -i NONE --cmd "%s"]]
.. [[ -c "call writefile([has('ttyin'), has('ttyout')], 'Xtest_startup_ttyout')"]]
.. [[ -c q | cat -v]]
):format(nvim_prog, nvim_set),
{
+ term = true,
env = {
VIMRUNTIME = os.getenv('VIMRUNTIME'),
},
@@ -424,7 +430,7 @@ describe('startup', function()
os.remove('Xtest_startup_ttyout')
end)
-- Running in :terminal
- fn.termopen(
+ fn.jobstart(
(
[[echo foo | ]] -- Input from a pipe.
.. [["%s" -u NONE -i NONE --cmd "%s"]]
@@ -432,6 +438,7 @@ describe('startup', function()
.. [[ -c q -- -]]
):format(nvim_prog, nvim_set),
{
+ term = true,
env = {
VIMRUNTIME = os.getenv('VIMRUNTIME'),
},
@@ -454,13 +461,14 @@ describe('startup', function()
command([[set shellcmdflag=/s\ /c shellxquote=\"]])
end
-- Running in :terminal
- fn.termopen(
+ fn.jobstart(
(
[[echo foo | ]]
.. [["%s" -u NONE -i NONE --cmd "%s"]]
.. [[ -c "echo has('ttyin') has('ttyout')"]]
):format(nvim_prog, nvim_set),
{
+ term = true,
env = {
VIMRUNTIME = os.getenv('VIMRUNTIME'),
},
@@ -614,7 +622,7 @@ describe('startup', function()
local screen
screen = Screen.new(60, 6)
screen._default_attr_ids = nil
- local id = fn.termopen({
+ local id = fn.jobstart({
nvim_prog,
'-u',
'NONE',
@@ -625,6 +633,7 @@ describe('startup', function()
'--cmd',
'let g:foo = g:bar',
}, {
+ term = true,
env = {
VIMRUNTIME = os.getenv('VIMRUNTIME'),
},
@@ -1144,7 +1153,8 @@ describe('user config init', function()
local screen = Screen.new(50, 8)
screen._default_attr_ids = nil
- fn.termopen({ nvim_prog }, {
+ fn.jobstart({ nvim_prog }, {
+ term = true,
env = {
VIMRUNTIME = os.getenv('VIMRUNTIME'),
},
@@ -1418,7 +1428,7 @@ describe('inccommand on ex mode', function()
clear()
local screen
screen = Screen.new(60, 10)
- local id = fn.termopen({
+ local id = fn.jobstart({
nvim_prog,
'-u',
'NONE',
@@ -1429,6 +1439,7 @@ describe('inccommand on ex mode', function()
'-E',
'test/README.md',
}, {
+ term = true,
env = { VIMRUNTIME = os.getenv('VIMRUNTIME') },
})
fn.chansend(id, '%s/N')
diff --git a/test/functional/editor/mode_normal_spec.lua b/test/functional/editor/mode_normal_spec.lua
index 5237f51237..353a261edb 100644
--- a/test/functional/editor/mode_normal_spec.lua
+++ b/test/functional/editor/mode_normal_spec.lua
@@ -26,10 +26,10 @@ describe('Normal mode', function()
it('&showcmd does not crash with :startinsert #28419', function()
local screen = Screen.new(60, 17)
- fn.termopen(
- { n.nvim_prog, '--clean', '--cmd', 'startinsert' },
- { env = { VIMRUNTIME = os.getenv('VIMRUNTIME') } }
- )
+ fn.jobstart({ n.nvim_prog, '--clean', '--cmd', 'startinsert' }, {
+ term = true,
+ env = { VIMRUNTIME = os.getenv('VIMRUNTIME') },
+ })
screen:expect({
grid = [[
^ |
diff --git a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua
index 2820cc9663..7234985009 100644
--- a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua
+++ b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua
@@ -115,7 +115,8 @@ describe("preserve and (R)ecover with custom 'directory'", function()
t.skip(t.is_os('win'))
local screen0 = Screen.new()
local child_server = new_pipename()
- fn.termopen({ nvim_prog, '-u', 'NONE', '-i', 'NONE', '--listen', child_server }, {
+ fn.jobstart({ nvim_prog, '-u', 'NONE', '-i', 'NONE', '--listen', child_server }, {
+ term = true,
env = { VIMRUNTIME = os.getenv('VIMRUNTIME') },
})
screen0:expect({ any = pesc('[No Name]') }) -- Wait for the child process to start.
@@ -446,9 +447,10 @@ describe('quitting swapfile dialog on startup stops TUI properly', function()
end)
it('(Q)uit at first file argument', function()
- local chan = fn.termopen(
+ local chan = fn.jobstart(
{ nvim_prog, '-u', 'NONE', '-i', 'NONE', '--cmd', init_dir, '--cmd', init_set, testfile },
{
+ term = true,
env = { VIMRUNTIME = os.getenv('VIMRUNTIME') },
}
)
@@ -468,7 +470,7 @@ describe('quitting swapfile dialog on startup stops TUI properly', function()
end)
it('(A)bort at second file argument with -p', function()
- local chan = fn.termopen({
+ local chan = fn.jobstart({
nvim_prog,
'-u',
'NONE',
@@ -482,6 +484,7 @@ describe('quitting swapfile dialog on startup stops TUI properly', function()
otherfile,
testfile,
}, {
+ term = true,
env = { VIMRUNTIME = os.getenv('VIMRUNTIME') },
})
retry(nil, nil, function()
@@ -508,7 +511,7 @@ describe('quitting swapfile dialog on startup stops TUI properly', function()
second %s /^ \zssecond$/
third %s /^ \zsthird$/]]):format(testfile, testfile, testfile)
)
- local chan = fn.termopen({
+ local chan = fn.jobstart({
nvim_prog,
'-u',
'NONE',
@@ -522,6 +525,7 @@ describe('quitting swapfile dialog on startup stops TUI properly', function()
'set tags=' .. otherfile,
'-tsecond',
}, {
+ term = true,
env = { VIMRUNTIME = os.getenv('VIMRUNTIME') },
})
retry(nil, nil, function()
diff --git a/test/functional/legacy/window_cmd_spec.lua b/test/functional/legacy/window_cmd_spec.lua
index d68c780f49..b58bf0bf43 100644
--- a/test/functional/legacy/window_cmd_spec.lua
+++ b/test/functional/legacy/window_cmd_spec.lua
@@ -120,7 +120,7 @@ describe('splitkeep', function()
row = 0,
col = 0,
}))
- vim.cmd("call termopen([&sh, &shcf, 'true'], { 'on_exit': 'C2' })")
+ vim.cmd("call jobstart([&sh, &shcf, 'true'], { 'term': v:true, 'on_exit': 'C2' })")
end
})]])
feed('j')
diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua
index edb4c928c1..e209ed9025 100644
--- a/test/functional/terminal/buffer_spec.lua
+++ b/test/functional/terminal/buffer_spec.lua
@@ -378,7 +378,7 @@ describe(':terminal buffer', function()
}, exec_lua('return _G.input'))
end)
- it('no heap-buffer-overflow when using termopen(echo) #3161', function()
+ it('no heap-buffer-overflow when using jobstart("echo",{term=true}) #3161', function()
local testfilename = 'Xtestfile-functional-terminal-buffers_spec'
write_file(testfilename, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaa')
finally(function()
@@ -387,8 +387,8 @@ describe(':terminal buffer', function()
feed_command('edit ' .. testfilename)
-- Move cursor away from the beginning of the line
feed('$')
- -- Let termopen() modify the buffer
- feed_command('call termopen("echo")')
+ -- Let jobstart(…,{term=true}) modify the buffer
+ feed_command([[call jobstart("echo", {'term':v:true})]])
assert_alive()
feed_command('bdelete!')
end)
@@ -411,7 +411,7 @@ describe(':terminal buffer', function()
it('handles split UTF-8 sequences #16245', function()
local screen = Screen.new(50, 7)
- fn.termopen({ testprg('shell-test'), 'UTF-8' })
+ fn.jobstart({ testprg('shell-test'), 'UTF-8' }, { term = true })
screen:expect([[
^å |
ref: å̲ |
@@ -669,7 +669,7 @@ if is_os('win') then
end)
end
-describe('termopen()', function()
+describe('termopen() (deprecated alias to `jobstart(…,{term=true})`)', function()
before_each(clear)
it('disallowed when textlocked and in cmdwin buffer', function()
diff --git a/test/functional/terminal/channel_spec.lua b/test/functional/terminal/channel_spec.lua
index 9912c1ff7b..bb97411f43 100644
--- a/test/functional/terminal/channel_spec.lua
+++ b/test/functional/terminal/channel_spec.lua
@@ -75,8 +75,8 @@ describe('terminal channel is closed and later released if', function()
eq(chans - 1, eval('len(nvim_list_chans())'))
end)
- it('opened by termopen(), exited, and deleted by pressing a key', function()
- command([[let id = termopen('echo')]])
+ it('opened by jobstart(…,{term=true}), exited, and deleted by pressing a key', function()
+ command([[let id = jobstart('echo',{'term':v:true})]])
local chans = eval('len(nvim_list_chans())')
-- wait for process to exit
screen:expect({ any = '%[Process exited 0%]' })
@@ -96,8 +96,8 @@ describe('terminal channel is closed and later released if', function()
end)
-- This indirectly covers #16264
- it('opened by termopen(), exited, and deleted by :bdelete', function()
- command([[let id = termopen('echo')]])
+ it('opened by jobstart(…,{term=true}), exited, and deleted by :bdelete', function()
+ command([[let id = jobstart('echo', {'term':v:true})]])
local chans = eval('len(nvim_list_chans())')
-- wait for process to exit
screen:expect({ any = '%[Process exited 0%]' })
@@ -124,7 +124,7 @@ it('chansend sends lines to terminal channel in proper order', function()
screen._default_attr_ids = nil
local shells = is_os('win') and { 'cmd.exe', 'pwsh.exe -nop', 'powershell.exe -nop' } or { 'sh' }
for _, sh in ipairs(shells) do
- command([[let id = termopen(']] .. sh .. [[')]])
+ command([[let id = jobstart(']] .. sh .. [[', {'term':v:true})]])
command([[call chansend(id, ['echo "hello"', 'echo "world"', ''])]])
screen:expect {
any = [[echo "hello".*echo "world"]],
@@ -149,7 +149,7 @@ describe('no crash when TermOpen autocommand', function()
})
end)
- it('processes job exit event when using termopen()', function()
+ it('processes job exit event when using jobstart(…,{term=true})', function()
command([[autocmd TermOpen * call input('')]])
async_meths.nvim_command('terminal foobar')
screen:expect {
@@ -179,7 +179,7 @@ describe('no crash when TermOpen autocommand', function()
assert_alive()
end)
- it('wipes buffer and processes events when using termopen()', function()
+ it('wipes buffer and processes events when using jobstart(…,{term=true})', function()
command([[autocmd TermOpen * bwipe! | call input('')]])
async_meths.nvim_command('terminal foobar')
screen:expect {
diff --git a/test/functional/terminal/clipboard_spec.lua b/test/functional/terminal/clipboard_spec.lua
index 4a1a0e29fd..f0ce407eaa 100644
--- a/test/functional/terminal/clipboard_spec.lua
+++ b/test/functional/terminal/clipboard_spec.lua
@@ -56,7 +56,7 @@ describe(':terminal', function()
return string.format('\027]52;;%s\027\\', arg)
end
- fn.termopen({ testprg('shell-test'), '-t', osc52(encoded) })
+ fn.jobstart({ testprg('shell-test'), '-t', osc52(encoded) }, { term = true })
retry(nil, 1000, function()
eq(text, exec_lua([[ return vim.g.clipboard_data ]]))
diff --git a/test/functional/terminal/cursor_spec.lua b/test/functional/terminal/cursor_spec.lua
index 368afd6d36..8594a9ce16 100644
--- a/test/functional/terminal/cursor_spec.lua
+++ b/test/functional/terminal/cursor_spec.lua
@@ -239,7 +239,7 @@ describe(':terminal cursor', function()
feed([[<C-\><C-N>]])
command('set statusline=~~~')
command('new')
- call('termopen', { testprg('tty-test') })
+ call('jobstart', { testprg('tty-test') }, { term = true })
feed('i')
screen:expect({
grid = [[
diff --git a/test/functional/terminal/ex_terminal_spec.lua b/test/functional/terminal/ex_terminal_spec.lua
index 5ebe7bd4fc..5224d322d3 100644
--- a/test/functional/terminal/ex_terminal_spec.lua
+++ b/test/functional/terminal/ex_terminal_spec.lua
@@ -175,7 +175,7 @@ local function test_terminal_with_fake_shell(backslash)
api.nvim_set_option_value('shellxquote', '', {}) -- win: avoid extra quotes
end)
- it('with no argument, acts like termopen()', function()
+ it('with no argument, acts like jobstart(…,{term=true})', function()
command('autocmd! nvim_terminal TermClose')
feed_command('terminal')
screen:expect([[
@@ -196,7 +196,7 @@ local function test_terminal_with_fake_shell(backslash)
]])
end)
- it("with no argument, but 'shell' has arguments, acts like termopen()", function()
+ it("with no argument, but 'shell' has arguments, acts like jobstart(…,{term=true})", function()
api.nvim_set_option_value('shell', shell_path .. ' INTERACT', {})
feed_command('terminal')
screen:expect([[
diff --git a/test/functional/terminal/highlight_spec.lua b/test/functional/terminal/highlight_spec.lua
index 5ed3c72b72..c43d139f70 100644
--- a/test/functional/terminal/highlight_spec.lua
+++ b/test/functional/terminal/highlight_spec.lua
@@ -33,7 +33,7 @@ describe(':terminal highlight', function()
[12] = { bold = true, underdouble = true },
[13] = { italic = true, undercurl = true },
})
- command(("enew | call termopen(['%s'])"):format(testprg('tty-test')))
+ command(("enew | call jobstart(['%s'], {'term':v:true})"):format(testprg('tty-test')))
feed('i')
screen:expect([[
tty ready |
@@ -150,7 +150,7 @@ it(':terminal highlight has lower precedence than editor #9964', function()
},
})
-- Child nvim process in :terminal (with cterm colors).
- fn.termopen({
+ fn.jobstart({
nvim_prog_abs(),
'-n',
'-u',
@@ -163,6 +163,7 @@ it(':terminal highlight has lower precedence than editor #9964', function()
'+norm! ichild nvim',
'+norm! oline 2',
}, {
+ term = true,
env = {
VIMRUNTIME = os.getenv('VIMRUNTIME'),
},
@@ -200,7 +201,7 @@ it('CursorLine and CursorColumn work in :terminal buffer in Normal mode', functi
[4] = { background = Screen.colors.Grey90, reverse = true },
[5] = { background = Screen.colors.Red },
})
- command(("enew | call termopen(['%s'])"):format(testprg('tty-test')))
+ command(("enew | call jobstart(['%s'], {'term':v:true})"):format(testprg('tty-test')))
screen:expect([[
^tty ready |
|*6
@@ -318,7 +319,7 @@ describe(':terminal highlight forwarding', function()
[2] = { { fg_indexed = true, foreground = tonumber('0xe0e000') }, { foreground = 3 } },
[3] = { { foreground = tonumber('0xff8000') }, {} },
})
- command(("enew | call termopen(['%s'])"):format(testprg('tty-test')))
+ command(("enew | call jobstart(['%s'], {'term':v:true})"):format(testprg('tty-test')))
feed('i')
screen:expect([[
tty ready |
@@ -364,7 +365,7 @@ describe(':terminal highlight with custom palette', function()
[9] = { bold = true },
})
api.nvim_set_var('terminal_color_3', '#123456')
- command(("enew | call termopen(['%s'])"):format(testprg('tty-test')))
+ command(("enew | call jobstart(['%s'], {'term':v:true})"):format(testprg('tty-test')))
feed('i')
screen:expect([[
tty ready |
diff --git a/test/functional/terminal/scrollback_spec.lua b/test/functional/terminal/scrollback_spec.lua
index 0de7873200..804c5367eb 100644
--- a/test/functional/terminal/scrollback_spec.lua
+++ b/test/functional/terminal/scrollback_spec.lua
@@ -355,7 +355,9 @@ describe(':terminal prints more lines than the screen height and exits', functio
it('will push extra lines to scrollback', function()
clear()
local screen = Screen.new(30, 7, { rgb = false })
- command(("call termopen(['%s', '10']) | startinsert"):format(testprg('tty-test')))
+ command(
+ ("call jobstart(['%s', '10'], {'term':v:true}) | startinsert"):format(testprg('tty-test'))
+ )
screen:expect([[
line6 |
line7 |
@@ -623,7 +625,7 @@ describe('pending scrollback line handling', function()
local bufnr = vim.api.nvim_create_buf(false, true)
local args = ...
vim.api.nvim_buf_call(bufnr, function()
- vim.fn.termopen(args)
+ vim.fn.jobstart(args, { term = true })
end)
vim.api.nvim_win_set_buf(0, bufnr)
vim.cmd('startinsert')
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index 832bacb534..de92aefd5b 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -2114,7 +2114,7 @@ describe('TUI', function()
[5] = { bold = true, reverse = true },
[6] = { foreground = Screen.colors.White, background = Screen.colors.DarkGreen },
})
- fn.termopen({
+ fn.jobstart({
nvim_prog,
'--clean',
'--cmd',
@@ -2124,6 +2124,7 @@ describe('TUI', function()
'--cmd',
'let start = reltime() | while v:true | if reltimefloat(reltime(start)) > 2 | break | endif | endwhile',
}, {
+ term = true,
env = {
VIMRUNTIME = os.getenv('VIMRUNTIME'),
},
@@ -2146,7 +2147,7 @@ describe('TUI', function()
for _, guicolors in ipairs({ 'notermguicolors', 'termguicolors' }) do
it('has no black flicker when clearing regions during startup with ' .. guicolors, function()
local screen = Screen.new(50, 10)
- fn.termopen({
+ fn.jobstart({
nvim_prog,
'--clean',
'--cmd',
@@ -2154,6 +2155,7 @@ describe('TUI', function()
'--cmd',
'sleep 10',
}, {
+ term = true,
env = {
VIMRUNTIME = os.getenv('VIMRUNTIME'),
},
diff --git a/test/functional/testterm.lua b/test/functional/testterm.lua
index 7ae28dce69..17209d947e 100644
--- a/test/functional/testterm.lua
+++ b/test/functional/testterm.lua
@@ -141,7 +141,7 @@ function M.setup_screen(extra_rows, cmd, cols, env, screen_opts)
})
api.nvim_command('enew')
- api.nvim_call_function('termopen', { cmd, env and { env = env } or nil })
+ api.nvim_call_function('jobstart', { cmd, { term = true, env = (env and env or nil) } })
api.nvim_input('<CR>')
local vim_errmsg = api.nvim_eval('v:errmsg')
if vim_errmsg and '' ~= vim_errmsg then
diff --git a/test/functional/ui/hlstate_spec.lua b/test/functional/ui/hlstate_spec.lua
index 745ad70efe..e10c79fa48 100644
--- a/test/functional/ui/hlstate_spec.lua
+++ b/test/functional/ui/hlstate_spec.lua
@@ -224,7 +224,7 @@ describe('ext_hlstate detailed highlights', function()
[6] = { { foreground = tonumber('0x40ffff'), fg_indexed = true }, { 5, 1 } },
[7] = { {}, { { hi_name = 'MsgArea', ui_name = 'MsgArea', kind = 'ui' } } },
})
- command(("enew | call termopen(['%s'])"):format(testprg('tty-test')))
+ command(("enew | call jobstart(['%s'],{'term':v:true})"):format(testprg('tty-test')))
screen:expect([[
^tty ready |
|
diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua
index 6d8c6609c8..d48d56aeb6 100644
--- a/test/functional/ui/messages_spec.lua
+++ b/test/functional/ui/messages_spec.lua
@@ -2062,7 +2062,7 @@ describe('ui/msg_puts_printf', function()
)
cmd = cmd .. '"' .. nvim_prog .. '" -u NONE -i NONE -Es -V1'
- command([[call termopen(']] .. cmd .. [[')]])
+ command([[call jobstart(']] .. cmd .. [[',{'term':v:true})]])
screen:expect([[
^Exモードに入ります。ノー |
マルモードに戻るには "vis|
diff --git a/test/functional/ui/title_spec.lua b/test/functional/ui/title_spec.lua
index aa9ac3f5b5..2de1e71457 100644
--- a/test/functional/ui/title_spec.lua
+++ b/test/functional/ui/title_spec.lua
@@ -80,7 +80,7 @@ describe('title', function()
it('is updated in Terminal mode', function()
api.nvim_set_option_value('title', true, {})
api.nvim_set_option_value('titlestring', '(%{mode(1)}) | nvim', {})
- fn.termopen({ n.testprg('shell-test'), 'INTERACT' })
+ fn.jobstart({ n.testprg('shell-test'), 'INTERACT' }, { term = true })
screen:expect(function()
eq('(nt) | nvim', screen.title)
end)
diff --git a/test/old/testdir/runnvim.vim b/test/old/testdir/runnvim.vim
index 578614c8a1..f5945aeaee 100644
--- a/test/old/testdir/runnvim.vim
+++ b/test/old/testdir/runnvim.vim
@@ -8,6 +8,7 @@ function s:logger.on_exit(id, data, event)
endfunction
let s:logger.env = #{VIMRUNTIME: $VIMRUNTIME}
+let s:logger.term = v:true
" Replace non-printable chars by special sequence, or "<%x>".
let s:escaped_char = {"\n": '\n', "\r": '\r', "\t": '\t'}
@@ -25,7 +26,7 @@ function Main()
set lines=25
set columns=80
enew
- let job = termopen(args, s:logger)
+ let job = jobstart(args, s:logger)
let results = jobwait([job], 5 * 60 * 1000)
" TODO(ZyX-I): Get colors
let screen = getline(1, '$')