Mercurial > vim
comparison src/testdir/test_channel.vim @ 8491:daebcbd87bd3 v7.4.1536
commit https://github.com/vim/vim/commit/de27989157f35172b25f9e01e0c147ed8f6ae3ce
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Mar 11 22:19:44 2016 +0100
patch 7.4.1536
Problem: Cannot re-use a channel for another job.
Solution: Add the "channel" option to job_start().
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 11 Mar 2016 22:30:04 +0100 |
parents | c08c6d19db4d |
children | 1227dc21865b |
comparison
equal
deleted
inserted
replaced
8490:eceb3c28e179 | 8491:daebcbd87bd3 |
---|---|
915 call assert_equal('channel fail', string(job_getchannel(job))) | 915 call assert_equal('channel fail', string(job_getchannel(job))) |
916 call assert_equal('fail', ch_status(job)) | 916 call assert_equal('fail', ch_status(job)) |
917 call job_stop(job) | 917 call job_stop(job) |
918 endfunc | 918 endfunc |
919 | 919 |
920 func Test_reuse_channel() | |
921 if !has('job') | |
922 return | |
923 endif | |
924 call ch_log('Test_reuse_channel()') | |
925 | |
926 let job = job_start(s:python . " test_channel_pipe.py") | |
927 call assert_equal("run", job_status(job)) | |
928 let handle = job_getchannel(job) | |
929 try | |
930 call ch_sendraw(handle, "echo something\n") | |
931 call assert_equal("something", ch_readraw(handle)) | |
932 finally | |
933 call job_stop(job) | |
934 endtry | |
935 | |
936 let job = job_start(s:python . " test_channel_pipe.py", {'channel': handle}) | |
937 call assert_equal("run", job_status(job)) | |
938 let handle = job_getchannel(job) | |
939 try | |
940 call ch_sendraw(handle, "echo again\n") | |
941 call assert_equal("again", ch_readraw(handle)) | |
942 finally | |
943 call job_stop(job) | |
944 endtry | |
945 endfunc | |
946 | |
920 """""""""" | 947 """""""""" |
921 | 948 |
922 let s:unletResponse = '' | 949 let s:unletResponse = '' |
923 func s:UnletHandler(handle, msg) | 950 func s:UnletHandler(handle, msg) |
924 let s:unletResponse = a:msg | 951 let s:unletResponse = a:msg |