Mercurial > vim
diff src/testdir/test_channel.vim @ 8291:ac0c43e7af20 v7.4.1438
commit https://github.com/vim/vim/commit/c7f0ebc6d1e1cdaed816b88a0d6092c5ace615eb
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 27 21:10:09 2016 +0100
patch 7.4.1438
Problem: Can't get buffer number of a channel.
Solution: Add ch_getbufnr().
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 27 Feb 2016 21:15:04 +0100 |
parents | e05e28dcb590 |
children | 5e88bd55b789 |
line wrap: on
line diff
--- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -400,6 +400,32 @@ func Test_pipe_to_buffer() endtry endfunc +func Test_pipe_to_nameless_buffer() + if !has('job') + return + endif + call ch_log('Test_pipe_to_nameless_buffer()') + let job = job_start(s:python . " test_channel_pipe.py", + \ {'out-io': 'buffer'}) + call assert_equal("run", job_status(job)) + try + let handle = job_getchannel(job) + call ch_sendraw(handle, "echo line one\n") + call ch_sendraw(handle, "echo line two\n") + exe ch_getbufnr(handle, "out") . 'sbuf' + for i in range(100) + sleep 10m + if line('$') >= 3 + break + endif + endfor + call assert_equal(['Reading from channel output...', 'line one', 'line two'], getline(1, '$')) + bwipe! + finally + call job_stop(job) + endtry +endfunc + """""""""" let s:unletResponse = ''