diff src/testdir/test_channel.vim @ 8455:d0717262d802 v7.4.1518

commit https://github.com/vim/vim/commit/f65333c9b59654a70f2a07200f65c93dfcaa49b3 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Mar 8 18:27:21 2016 +0100 patch 7.4.1518 Problem: Channel with disconnected in/out/err is not supported. Solution: Implement it for Unix.
author Christian Brabandt <cb@256bit.org>
date Tue, 08 Mar 2016 18:30:05 +0100
parents 3d567b5839c5
children 20533e3de373
line wrap: on
line diff
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -784,6 +784,58 @@ func Test_pipe_io_one_buffer()
   endtry
 endfunc
 
+func Test_pipe_null()
+  if !has('job')
+    return
+  endif
+  " TODO: implement this for MS-Windows
+  if !has('unix')
+    return
+  endif
+  call ch_log('Test_pipe_null()')
+
+  " We cannot check that no I/O works, we only check that the job starts
+  " properly.
+  let job = job_start(s:python . " test_channel_pipe.py something",
+	\ {'in-io': 'null'})
+  call assert_equal("run", job_status(job))
+  try
+    call assert_equal('something', ch_read(job))
+  finally
+    call job_stop(job)
+  endtry
+
+  let job = job_start(s:python . " test_channel_pipe.py err-out",
+	\ {'out-io': 'null'})
+  call assert_equal("run", job_status(job))
+  try
+    call assert_equal('err-out', ch_read(job, {"part": "err"}))
+  finally
+    call job_stop(job)
+  endtry
+
+  let job = job_start(s:python . " test_channel_pipe.py something",
+	\ {'err-io': 'null'})
+  call assert_equal("run", job_status(job))
+  try
+    call assert_equal('something', ch_read(job))
+  finally
+    call job_stop(job)
+  endtry
+
+  let job = job_start(s:python . " test_channel_pipe.py something",
+	\ {'out-io': 'null', 'err-io': 'out'})
+  call assert_equal("run", job_status(job))
+  call job_stop(job)
+
+  let job = job_start(s:python . " test_channel_pipe.py something",
+	\ {'in-io': 'null', 'out-io': 'null', 'err-io': 'null'})
+  call assert_equal("run", job_status(job))
+  call assert_equal('channel fail', string(job_getchannel(job)))
+  call assert_equal('fail', ch_status(job))
+  call job_stop(job)
+endfunc
+
 """"""""""
 
 let s:unletResponse = ''