diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-12-09 19:13:13 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-12-09 19:13:13 +0100 |
commit | 620ca2da372dc9c892022faff83d363c67cc5c45 (patch) | |
tree | f1315ceb93d6cdee927169ee0e349a3b352dcbb5 /src/testdir/test_channel.vim | |
parent | 05684310a53c8a4804441c1c6f8b7fc9e8194940 (diff) |
patch 8.0.1381: ch_readraw() waits for NL if channel mode is NLv8.0.1381
Problem: ch_readraw() waits for NL if channel mode is NL.
Solution: Pass a "raw" flag to channel_read_block(). (Yasuhiro Matsumoto)
Diffstat (limited to 'src/testdir/test_channel.vim')
-rw-r--r-- | src/testdir/test_channel.vim | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim index 034bd39778..1859afc5b8 100644 --- 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 |