aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/job/job_spec.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/functional/job/job_spec.lua b/test/functional/job/job_spec.lua
index b2a65f8269..9046d85f10 100644
--- a/test/functional/job/job_spec.lua
+++ b/test/functional/job/job_spec.lua
@@ -15,6 +15,10 @@ describe('jobs', function()
return "au! JobActivity xxx call rpcnotify("..channel..", "..expr..")"
end
+ local notify_job = function()
+ return "au! JobActivity xxx call rpcnotify("..channel..", 'j', v:job_data)"
+ end
+
it('returns 0 when it fails to start', function()
local status, rv = pcall(eval, "jobstart('', '')")
eq(false, status)
@@ -56,4 +60,14 @@ describe('jobs', function()
it('will not cause a memory leak if we leave a job running', function()
nvim('command', "call jobstart('xxx', 'cat', ['-'])")
end)
+
+ it('will only emit the "exit" event after "stdout" and "stderr"', function()
+ nvim('command', notify_job())
+ nvim('command', "let j = jobstart('xxx', 'cat', ['-'])")
+ local jobid = nvim('eval', 'j')
+ nvim('eval', 'jobsend(j, "abc\ndef")')
+ nvim('eval', 'jobstop(j)')
+ eq({'notification', 'j', {{jobid, 'stdout', 'abc\ndef'}}}, next_message())
+ eq({'notification', 'j', {{jobid, 'exit'}}}, next_message())
+ end)
end)