diff src/testdir/test_channel.vim @ 11666:5cd9ba96561d v8.0.0716

patch 8.0.0716: not easy to start Vim cleanly commit https://github.com/vim/vim/commit/c4da113ef98dcfd6f2a088b1693c0317dcb5bf42 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 15 19:39:43 2017 +0200 patch 8.0.0716: not easy to start Vim cleanly Problem: Not easy to start Vim cleanly without changing the viminfo file. Not possible to know whether the -i command line flag was used. Solution: Add the --clean command line argument. Add the 'viminfofile' option. Add "-u DEFAULTS".
author Christian Brabandt <cb@256bit.org>
date Sat, 15 Jul 2017 19:45:03 +0200
parents 1c4ebbae41d2
children 2796a2c9fc17
line wrap: on
line diff
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -739,6 +739,38 @@ func Test_pipe_to_buffer_name_nomsg()
   call Run_test_pipe_to_buffer(1, 0, 1)
 endfunc
 
+func Test_close_output_buffer()
+  if !has('job')
+    return
+  endif
+  enew!
+  let test_lines = ['one', 'two']
+  call setline(1, test_lines)
+  call ch_log('Test_close_output_buffer()')
+  let options = {'out_io': 'buffer'}
+  let options['out_name'] = 'buffer-output'
+  let options['out_msg'] = 0
+  split buffer-output
+  let job = job_start(s:python . " test_channel_write.py", options)
+  call assert_equal("run", job_status(job))
+  try
+    call WaitFor('line("$") == 3')
+    call assert_equal(3, line('$'))
+    quit!
+    sleep 100m
+    " Make sure the write didn't happen to the wrong buffer.
+    call assert_equal(test_lines, getline(1, line('$')))
+    call assert_equal(-1, bufwinnr('buffer-output'))
+    sbuf buffer-output
+    call assert_notequal(-1, bufwinnr('buffer-output'))
+    sleep 100m
+    close  " no more writes
+    bwipe!
+  finally
+    call job_stop(job)
+  endtry
+endfunc
+
 func Run_test_pipe_err_to_buffer(use_name, nomod, do_msg)
   if !has('job')
     return