From 230c935e73c0eb8359b18f0da9ce2238cd7830bc Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Fri, 21 Nov 2014 15:21:03 -0300 Subject: 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). --- test/functional/job/job_spec.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/functional/job/job_spec.lua b/test/functional/job/job_spec.lua index 85a1e92e38..07ca0c0058 100644 --- a/test/functional/job/job_spec.lua +++ b/test/functional/job/job_spec.lua @@ -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() -- cgit