diff src/testdir/test_channel.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 1d2b5c016f17
children bfbdef46aa7d
line wrap: on
line diff
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -1945,10 +1945,11 @@ func Test_job_start_in_timer()
   endif
 
   func OutCb(chan, msg)
+    let g:val += 1
   endfunc
 
   func ExitCb(job, status)
-    let g:val = 1
+    let g:val += 1
     call Resume()
   endfunc
 
@@ -1967,6 +1968,10 @@ func Test_job_start_in_timer()
   call timer_start(1, 'TimerCb')
   let elapsed = Standby(&ut)
   call assert_inrange(1, &ut / 2, elapsed)
+
+  " Wait for both OutCb() and ExitCb() to have been called before deleting
+  " them.
+  call WaitForAssert({-> assert_equal(2, g:val)})
   call job_stop(g:job)
 
   delfunc OutCb