summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-08-27 19:21:48 +0200
committerBram Moolenaar <Bram@vim.org>2016-08-27 19:21:48 +0200
commit821179809d9b0f65177360b53584be2b4039dd46 (patch)
treec43d74281f27f6f484dbc3ffb4395cbaf252c677 /src
parente17bdffff78ebd6a4e3cff26754cc667557ea810 (diff)
downloadvim-821179809d9b0f65177360b53584be2b4039dd46.zip
patch 7.4.2270
Problem: Insufficient testing for NUL bytes on a raw channel. Solution: Add a test for writing and reading.
Diffstat (limited to 'src')
-rw-r--r--src/testdir/test_channel.vim38
-rw-r--r--src/version.c2
2 files changed, 39 insertions, 1 deletions
diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim
index ee52eef89..6ecbc789a 100644
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -1321,7 +1321,7 @@ func Test_using_freed_memory()
endfunc
func Test_collapse_buffers()
- if !executable('cat')
+ if !executable('cat') || !has('job')
return
endif
sp test_channel.vim
@@ -1335,6 +1335,42 @@ func Test_collapse_buffers()
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"
diff --git a/src/version.c b/src/version.c
index 289474ba8..097befc5f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2270,
+/**/
2269,
/**/
2268,