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".
diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim
index 3694fc2..c988968 100644
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -739,6 +739,38 @@
   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
diff --git a/src/testdir/test_channel_write.py b/src/testdir/test_channel_write.py
new file mode 100644
index 0000000..9c8813b
--- /dev/null
+++ b/src/testdir/test_channel_write.py
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+#
+# Program that writes a number to stdout repeatedly
+#
+# This requires Python 2.6 or later.
+
+from __future__ import print_function
+import sys
+import time
+
+if __name__ == "__main__":
+
+    done = 0
+    while done < 10:
+        done = done + 1
+        print(done)
+        sys.stdout.flush()
+        time.sleep(0.05)  # sleep 50 msec