diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-03-08 20:12:44 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-03-08 20:12:44 +0100 |
commit | 6ff02c96519946716069f05c62849986a706033b (patch) | |
tree | 58c572f3eef9deb0d24013053e2cc081416860fa /src/testdir/test_channel.vim | |
parent | 8322e1f06e8fa39a6bb790a7d8d7db5d7aff3366 (diff) | |
download | vim-6ff02c96519946716069f05c62849986a706033b.zip |
patch 7.4.1522
Problem: Cannot write channel err to a buffer.
Solution: Implement it.
Diffstat (limited to 'src/testdir/test_channel.vim')
-rw-r--r-- | src/testdir/test_channel.vim | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim index 061b30c25..7b531c8f0 100644 --- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -633,6 +633,53 @@ func Test_pipe_to_buffer() endtry endfunc +func Test_pipe_err_to_buffer() + if !has('job') + return + endif + call ch_log('Test_pipe_err_to_buffer()') + let job = job_start(s:python . " test_channel_pipe.py", + \ {'err-io': 'buffer', 'err-name': 'pipe-err'}) + call assert_equal("run", job_status(job)) + try + let handle = job_getchannel(job) + call ch_sendraw(handle, "echoerr line one\n") + call ch_sendraw(handle, "echoerr line two\n") + call ch_sendraw(handle, "doubleerr this\n") + call ch_sendraw(handle, "quit\n") + sp pipe-err + call s:waitFor('line("$") >= 5') + call assert_equal(['Reading from channel error...', 'line one', 'line two', 'this', 'AND this'], getline(1, '$')) + bwipe! + finally + call job_stop(job) + endtry +endfunc + +func Test_pipe_both_to_buffer() + if !has('job') + return + endif + call ch_log('Test_pipe_both_to_buffer()') + let job = job_start(s:python . " test_channel_pipe.py", + \ {'out-io': 'buffer', 'out-name': 'pipe-err', 'err-io': 'out'}) + 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, "echoerr line two\n") + call ch_sendraw(handle, "double this\n") + call ch_sendraw(handle, "doubleerr that\n") + call ch_sendraw(handle, "quit\n") + sp pipe-err + call s:waitFor('line("$") >= 7') + call assert_equal(['Reading from channel output...', 'line one', 'line two', 'this', 'AND this', 'that', 'AND that', 'Goodbye!'], getline(1, '$')) + bwipe! + finally + call job_stop(job) + endtry +endfunc + func Test_pipe_from_buffer() if !has('job') return |