diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2024-12-19 07:07:04 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-19 07:07:04 -0800 |
commit | 8ef41f590224dfeea2e51d9fec150e363fd72ee0 (patch) | |
tree | 2c9879066ef7e70dc1d178d46e2048bf1470f818 /test/functional/terminal/channel_spec.lua | |
parent | a5a4149e9754a96c063a357c18397aa7906edf53 (diff) | |
download | rneovim-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/functional/terminal/channel_spec.lua')
-rw-r--r-- | test/functional/terminal/channel_spec.lua | 14 |
1 files changed, 7 insertions, 7 deletions
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 { |