diff src/testdir/test_terminal.vim @ 15583:3137345451a4 v8.1.0799

patch 8.1.0799: calling deleted function; test doesn't work on Mac commit https://github.com/vim/vim/commit/cfc15237ab88ecb78b12030f6e04b87618b56124 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jan 23 22:33:18 2019 +0100 patch 8.1.0799: calling deleted function; test doesn't work on Mac Problem: Calling deleted function; test doesn't work on Mac. Solution: Wait for the function to be called before deleting it. Use a job to write to the pty, unless in the GUI. (Ozaki Kiichi, closes #3854)
author Bram Moolenaar <Bram@vim.org>
date Wed, 23 Jan 2019 22:45:04 +0100
parents f611222a4349
children 2dcaa860e3fc
line wrap: on
line diff
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -643,19 +643,17 @@ func Test_terminal_write_stdin()
 endfunc
 
 func Test_terminal_no_cmd()
-  " Does not work on Mac.
-  if has('mac')
-    return
-  endif
   let buf = term_start('NONE', {})
   call assert_notequal(0, buf)
 
   let pty = job_info(term_getjob(buf))['tty_out']
   call assert_notequal('', pty)
-  if has('win32')
-    silent exe '!start cmd /c "echo look here > ' . pty . '"'
+  if has('gui_running') && !has('win32')
+    " In the GUI job_start() doesn't work, it does not read from the pty.
+    call system('echo "look here" > ' . pty)
   else
-    call system('echo "look here" > ' . pty)
+    " Otherwise using a job works on all systems.
+    call job_start([&shell, &shellcmdflag, 'echo "look here" > ' . pty])
   endif
   call WaitForAssert({-> assert_match('look here', term_getline(buf, 1))})