mirror of
https://github.com/neovim/neovim.git
synced 2025-09-25 20:48:32 +00:00
test: Fix problems in job_spec.lua
Nvim wasn't exiting cleanly in some job tests due to errors. This can't be noticed until the next commit, which will perform a refactoring to selectively process K_EVENT, so the `qa!` command executed at the end of each test blocks forever if there are errors which require the user to press ENTER(in that state Nvim no longer will process events).
This commit is contained in:
@@ -37,7 +37,7 @@ describe('jobs', function()
|
||||
end)
|
||||
|
||||
it('allows interactive commands', function()
|
||||
nvim('command', notify_str('v:job_data[1]', 'v:job_data[2]'))
|
||||
nvim('command', notify_str('v:job_data[1]', 'get(v:job_data, 2)'))
|
||||
nvim('command', "let j = jobstart('xxx', 'cat', ['-'])")
|
||||
neq(0, eval('j'))
|
||||
nvim('command', 'call jobsend(j, "abc\\n")')
|
||||
@@ -46,9 +46,8 @@ describe('jobs', function()
|
||||
eq({'notification', 'stdout', {{'123', 'xyz'}}}, next_message())
|
||||
nvim('command', 'call jobsend(j, [123, "xyz"])')
|
||||
eq({'notification', 'stdout', {{'123', 'xyz'}}}, next_message())
|
||||
nvim('command', notify_str('v:job_data[1])'))
|
||||
nvim('command', "call jobstop(j)")
|
||||
eq({'notification', 'exit', {}}, next_message())
|
||||
eq({'notification', 'exit', {0}}, next_message())
|
||||
end)
|
||||
|
||||
it('preserves NULs', function()
|
||||
@@ -59,9 +58,10 @@ describe('jobs', function()
|
||||
file:close()
|
||||
|
||||
-- v:job_data preserves NULs.
|
||||
nvim('command', notify_str('v:job_data[1]', 'v:job_data[2]'))
|
||||
nvim('command', notify_str('v:job_data[1]', 'get(v:job_data, 2)'))
|
||||
nvim('command', "let j = jobstart('xxx', 'cat', ['"..filename.."'])")
|
||||
eq({'notification', 'stdout', {{'abc\ndef'}}}, next_message())
|
||||
eq({'notification', 'exit', {0}}, next_message())
|
||||
os.remove(filename)
|
||||
|
||||
-- jobsend() preserves NULs.
|
||||
@@ -72,12 +72,13 @@ describe('jobs', function()
|
||||
end)
|
||||
|
||||
it('will hold data if it does not end in a newline', function()
|
||||
nvim('command', notify_str('v:job_data[1]', 'v:job_data[2]'))
|
||||
nvim('command', notify_str('v:job_data[1]', 'get(v:job_data, 2)'))
|
||||
nvim('command', "let j = jobstart('xxx', 'cat', ['-'])")
|
||||
nvim('command', 'call jobsend(j, "abc\\nxyz")')
|
||||
eq({'notification', 'stdout', {{'abc'}}}, next_message())
|
||||
nvim('command', "call jobstop(j)")
|
||||
eq({'notification', 'stdout', {{'xyz'}}}, next_message())
|
||||
eq({'notification', 'exit', {0}}, next_message())
|
||||
end)
|
||||
|
||||
it('will not allow jobsend/stop on a non-existent job', function()
|
||||
|
Reference in New Issue
Block a user