Mercurial > vim
diff src/testdir/test_channel.vim @ 13010:c522585ce88d v8.0.1381
patch 8.0.1381: ch_readraw() waits for NL if channel mode is NL
commit https://github.com/vim/vim/commit/620ca2da372dc9c892022faff83d363c67cc5c45
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Dec 9 19:13:13 2017 +0100
patch 8.0.1381: ch_readraw() waits for NL if channel mode is NL
Problem: ch_readraw() waits for NL if channel mode is NL.
Solution: Pass a "raw" flag to channel_read_block(). (Yasuhiro Matsumoto)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 09 Dec 2017 19:15:05 +0100 |
parents | 6cf6138b6484 |
children | 179586a64f53 |
line wrap: on
line diff
--- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -515,7 +515,7 @@ func Test_nl_pipe() call assert_equal("AND this", ch_readraw(handle)) call ch_sendraw(handle, "split this line\n") - call assert_equal("this linethis linethis line", ch_readraw(handle)) + call assert_equal("this linethis linethis line", ch_read(handle)) let reply = ch_evalraw(handle, "quit\n") call assert_equal("Goodbye!", reply) @@ -1266,6 +1266,31 @@ func Test_read_in_close_cb() endtry endfunc +" Use channel in NL mode but received text does not end in NL. +func Test_read_in_close_cb_incomplete() + if !has('job') + return + endif + call ch_log('Test_read_in_close_cb_incomplete()') + + let g:Ch_received = '' + func! CloseHandler(chan) + while ch_status(a:chan, {'part': 'out'}) == 'buffered' + let g:Ch_received .= ch_read(a:chan) + endwhile + endfunc + let job = job_start(s:python . " test_channel_pipe.py incomplete", + \ {'close_cb': 'CloseHandler'}) + call assert_equal("run", job_status(job)) + try + call WaitFor('g:Ch_received != ""') + call assert_equal('incomplete', g:Ch_received) + finally + call job_stop(job) + delfunc CloseHandler + endtry +endfunc + func Test_out_cb_lambda() if !has('job') return