To: vim_dev@googlegroups.com Subject: Patch 7.4.2270 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.2270 Problem: Insufficient testing for NUL bytes on a raw channel. Solution: Add a test for writing and reading. Files: src/testdir/test_channel.vim *** ../vim-7.4.2269/src/testdir/test_channel.vim 2016-08-26 19:20:22.976029324 +0200 --- src/testdir/test_channel.vim 2016-08-27 19:11:25.399352831 +0200 *************** *** 1321,1327 **** endfunc func Test_collapse_buffers() ! if !executable('cat') return endif sp test_channel.vim --- 1321,1327 ---- endfunc func Test_collapse_buffers() ! if !executable('cat') || !has('job') return endif sp test_channel.vim *************** *** 1335,1340 **** --- 1335,1376 ---- bwipe! endfunc + func Test_raw_passes_nul() + if !executable('cat') || !has('job') + return + endif + + " Test lines from the job containing NUL are stored correctly in a buffer. + new + call setline(1, ["asdf\nasdf", "xxx\n", "\nyyy"]) + w! Xtestread + bwipe! + split testout + 1,$delete + call job_start('cat Xtestread', {'out_io': 'buffer', 'out_name': 'testout'}) + call WaitFor('line("$") > 2') + call assert_equal("asdf\nasdf", getline(2)) + call assert_equal("xxx\n", getline(3)) + call assert_equal("\nyyy", getline(4)) + + call delete('Xtestread') + bwipe! + + " Test lines from a buffer with NUL bytes are written correctly to the job. + new mybuffer + call setline(1, ["asdf\nasdf", "xxx\n", "\nyyy"]) + let g:Ch_job = job_start('cat', {'in_io': 'buffer', 'in_name': 'mybuffer', 'out_io': 'file', 'out_name': 'Xtestwrite'}) + call WaitFor('"dead" == job_status(g:Ch_job)') + bwipe! + split Xtestwrite + call assert_equal("asdf\nasdf", getline(1)) + call assert_equal("xxx\n", getline(2)) + call assert_equal("\nyyy", getline(3)) + + call delete('Xtestwrite') + bwipe! + endfunc + function Ch_test_close_lambda(port) let handle = ch_open('localhost:' . a:port, s:chopt) if ch_status(handle) == "fail" *** ../vim-7.4.2269/src/version.c 2016-08-27 18:34:25.566350721 +0200 --- src/version.c 2016-08-27 19:16:19.960789476 +0200 *************** *** 765,766 **** --- 765,768 ---- { /* Add new patch number below this line */ + /**/ + 2270, /**/ -- From "know your smileys": :-X My lips are sealed /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///