diff src/testdir/test_clientserver.vim @ 13798:415185e2c970 v8.0.1771

patch 8.0.1771: in tests, when WaitFor() fails it doesn't say why commit https://github.com/vim/vim/commit/50182fa84e20a0547f3e2bd6683ef799fcd27855 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 28 21:34:40 2018 +0200 patch 8.0.1771: in tests, when WaitFor() fails it doesn't say why Problem: In tests, when WaitFor() fails it doesn't say why. (James McCoy) Solution: Add WaitForAssert(), which produces an assert error when it fails.
author Christian Brabandt <cb@256bit.org>
date Sat, 28 Apr 2018 21:45:06 +0200
parents 87ffb7f85b28
children ba7727889385
line wrap: on
line diff
--- a/src/testdir/test_clientserver.vim
+++ b/src/testdir/test_clientserver.vim
@@ -28,12 +28,11 @@ func Test_client_server()
   let name = 'XVIMTEST'
   let cmd .= ' --servername ' . name
   let job = job_start(cmd, {'stoponexit': 'kill', 'out_io': 'null'})
-  call WaitFor({-> job_status(job) == "run"})
+  call WaitForAssert({-> assert_equal("run", job_status(job))})
 
   " Takes a short while for the server to be active.
   " When using valgrind it takes much longer.
-  call WaitFor('serverlist() =~ "' . name . '"')
-  call assert_match(name, serverlist())
+  call WaitForAssert({-> assert_match(name, serverlist())})
 
   call remote_foreground(name)
 
@@ -54,12 +53,10 @@ func Test_client_server()
     endif
     " Wait for the server to be up and answering requests.
     sleep 100m
-    call WaitFor('remote_expr("' . name . '", "v:version", "", 1) != ""')
-    call assert_true(remote_expr(name, "v:version", "", 1) != "")
+    call WaitForAssert({-> assert_true(remote_expr(name, "v:version", "", 1) != "")})
 
     call remote_send(name, ":let testvar = 'maybe'\<CR>")
-    call WaitFor('remote_expr("' . name . '", "testvar", "", 1) == "maybe"')
-    call assert_equal('maybe', remote_expr(name, "testvar", "", 2))
+    call WaitForAssert({-> assert_equal('maybe', remote_expr(name, "testvar", "", 2))})
   endif
 
   call assert_fails('call remote_send("XXX", ":let testvar = ''yes''\<CR>")', 'E241')
@@ -94,7 +91,7 @@ func Test_client_server()
 
   call remote_send(name, ":qa!\<CR>")
   try
-    call WaitFor({-> job_status(job) == "dead"})
+    call WaitForAssert({-> assert_equal("dead", job_status(job))})
   finally
     if job_status(job) != 'dead'
       call assert_report('Server did not exit')