Mercurial > vim
diff src/testdir/test_channel.vim @ 8430:800423dbc260 v7.4.1506
commit https://github.com/vim/vim/commit/b69fccf377f43544b86817b0de6cc1498a4ff9ec
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Mar 6 23:06:25 2016 +0100
patch 7.4.1506
Problem: Job cannot read from a file.
Solution: Implement reading from a file for Unix.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 06 Mar 2016 23:15:05 +0100 |
parents | 02ce040591c8 |
children | 0e6fd2f802b3 |
line wrap: on
line diff
--- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -524,6 +524,31 @@ func Test_nl_err_to_out_pipe() endtry endfunc +func Test_nl_read_file() + if !has('job') + return + endif + " TODO: make this work for MS-Windows. + if !has('unix') + return + endif + call ch_log('Test_nl_read_file()') + call writefile(['echo something', 'echoerr wrong', 'double this'], 'Xinput') + let job = job_start(s:python . " test_channel_pipe.py", + \ {'in-io': 'file', 'in-name': 'Xinput'}) + call assert_equal("run", job_status(job)) + try + let handle = job_getchannel(job) + call assert_equal("something", ch_readraw(handle)) + call assert_equal("wrong", ch_readraw(handle, {'part': 'err'})) + call assert_equal("this", ch_readraw(handle)) + call assert_equal("AND this", ch_readraw(handle)) + finally + call job_stop(job) + call delete('Xinput') + endtry +endfunc + func Test_pipe_to_buffer() if !has('job') return @@ -556,7 +581,6 @@ func Test_pipe_from_buffer() if !has('job') return endif -call ch_logfile('channellog', 'w') call ch_log('Test_pipe_from_buffer()') sp pipe-input @@ -574,7 +598,6 @@ call ch_logfile('channellog', 'w') finally call job_stop(job) endtry -call ch_logfile('') endfunc func Test_pipe_to_nameless_buffer()