From 38806f23edfcba8cb7f7b80039d268ae3ffb0557 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 3 Sep 2019 10:25:27 -0700 Subject: [PATCH] test: enable "exit event follows stdout, stderr" [ci skip] #10929 - Update the test to work with changes since it was originally written. - Keep the test pending() because it still fails: Expected objects to be the same. Passed in: (table: 0x50ce9e38) { [1] = { [1] = 'notification' [2] = 'stderr' [3] = { [1] = 0 [2] = { [1] = '' } } } *[2] = { [1] = 'notification' [2] = 'stdout' *[3] = { [1] = 0 *[2] = { *[1] = '' } } } [3] = { [1] = 'notification' [2] = 'exit' [3] = { [1] = 0 [2] = 143 } } } Expected: (table: 0x50ce9870) { [1] = { [1] = 'notification' [2] = 'stderr' [3] = { [1] = 0 [2] = { [1] = '' } } } *[2] = { [1] = 'notification' [2] = 'stdout' *[3] = { [1] = 0 *[2] = { *[1] = 'abcdef' } } } [3] = { [1] = 'notification' [2] = 'stdout' [3] = { [1] = 0 [2] = { [1] = '' } } } } --- test/functional/core/job_spec.lua | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua index 3a1be7bc52..88951e5b51 100644 --- a/test/functional/core/job_spec.lua +++ b/test/functional/core/job_spec.lua @@ -733,15 +733,28 @@ describe('jobs', function() end) end) - -- FIXME need to wait until jobsend succeeds before calling jobstop - pending('will only emit the "exit" event after "stdout" and "stderr"', function() - nvim('command', "let g:job_opts.on_stderr = function('s:OnEvent')") + pending('exit event follows stdout, stderr', function() + nvim('command', "let g:job_opts.on_stderr = function('OnEvent')") nvim('command', "let j = jobstart(['cat', '-'], g:job_opts)") - local jobid = nvim('eval', 'j') nvim('eval', 'jobsend(j, "abcdef")') nvim('eval', 'jobstop(j)') - eq({'notification', 'j', {0, {jobid, 'stdout', {'abcdef'}}}}, next_msg()) - eq({'notification', 'j', {0, {jobid, 'exit'}}}, next_msg()) + expect_msg_seq( + { {'notification', 'stdout', {0, {'abcdef'}}}, + {'notification', 'stdout', {0, {''}}}, + {'notification', 'stderr', {0, {''}}}, + }, + -- Alternative sequence: + { {'notification', 'stderr', {0, {''}}}, + {'notification', 'stdout', {0, {'abcdef'}}}, + {'notification', 'stdout', {0, {''}}}, + }, + -- Alternative sequence: + { {'notification', 'stdout', {0, {'abcdef'}}}, + {'notification', 'stderr', {0, {''}}}, + {'notification', 'stdout', {0, {''}}}, + } + ) + eq({'notification', 'exit', {0, 143}}, next_msg()) end) it('cannot have both rpc and pty options', function()