summaryrefslogtreecommitdiff
path: root/src/testdir/test_channel.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-03-11 22:19:44 +0100
committerBram Moolenaar <Bram@vim.org>2016-03-11 22:19:44 +0100
commitde27989157f35172b25f9e01e0c147ed8f6ae3ce (patch)
treeac52ee2ae7bf82a4cc85f31b1c7b6f2993348c81 /src/testdir/test_channel.vim
parent9e496854a9fe56699687a4f86003fad115b3b375 (diff)
downloadvim-de27989157f35172b25f9e01e0c147ed8f6ae3ce.zip
patch 7.4.1536
Problem: Cannot re-use a channel for another job. Solution: Add the "channel" option to job_start().
Diffstat (limited to 'src/testdir/test_channel.vim')
-rw-r--r--src/testdir/test_channel.vim27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim
index 909afea8a..5f2b97f70 100644
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -917,6 +917,33 @@ func Test_pipe_null()
call job_stop(job)
endfunc
+func Test_reuse_channel()
+ if !has('job')
+ return
+ endif
+ call ch_log('Test_reuse_channel()')
+
+ let job = job_start(s:python . " test_channel_pipe.py")
+ call assert_equal("run", job_status(job))
+ let handle = job_getchannel(job)
+ try
+ call ch_sendraw(handle, "echo something\n")
+ call assert_equal("something", ch_readraw(handle))
+ finally
+ call job_stop(job)
+ endtry
+
+ let job = job_start(s:python . " test_channel_pipe.py", {'channel': handle})
+ call assert_equal("run", job_status(job))
+ let handle = job_getchannel(job)
+ try
+ call ch_sendraw(handle, "echo again\n")
+ call assert_equal("again", ch_readraw(handle))
+ finally
+ call job_stop(job)
+ endtry
+endfunc
+
""""""""""
let s:unletResponse = ''