Mercurial > vim
diff src/testdir/test_channel.vim @ 10249:920c73a27dda v8.0.0022
commit https://github.com/vim/vim/commit/ec68a99464055029c01082762517e97245ddae0c
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Oct 3 21:37:41 2016 +0200
patch 8.0.0022
Problem: If a channel in NL mode is missing the NL at the end the remaining
characters are dropped.
Solution: When the channel is closed use the remaining text. (Ozaki Kiichi)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 03 Oct 2016 21:45:04 +0200 |
parents | d709622a18c9 |
children | a09db7a4afe0 |
line wrap: on
line diff
--- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -1484,6 +1484,27 @@ func Test_raw_passes_nul() bwipe! endfunc +func MyLineCountCb(ch, msg) + let g:linecount += 1 +endfunc + +func Test_read_nonl_line() + if !has('job') + return + endif + + let g:linecount = 0 + if has('win32') + " workaround: 'shellescape' does improper escaping double quotes + let arg = 'import sys;sys.stdout.write(\"1\n2\n3\")' + else + let arg = 'import sys;sys.stdout.write("1\n2\n3")' + endif + call job_start([s:python, '-c', arg], {'callback': 'MyLineCountCb'}) + call WaitFor('3 <= g:linecount') + call assert_equal(3, g:linecount) +endfunc + function Ch_test_close_lambda(port) let handle = ch_open('localhost:' . a:port, s:chopt) if ch_status(handle) == "fail"