Mercurial > vim
diff src/testdir/test_channel.vim @ 12765:c1347c968d31 v8.0.1260
patch 8.0.1260: using global variables for WaitFor()
commit https://github.com/vim/vim/commit/ab8b1c14a31e36ae87cc7e13c4a75318d513fc7b
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Nov 4 19:24:31 2017 +0100
patch 8.0.1260: using global variables for WaitFor()
Problem: Using global variables for WaitFor().
Solution: Use a lambda function instead. Don't check a condition if
WaitFor() already checked it.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 04 Nov 2017 19:30:06 +0100 |
parents | 810a4c3d4f7e |
children | 6cf6138b6484 |
line wrap: on
line diff
--- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -274,12 +274,10 @@ func Ch_channel_handler(port) " Test that it works while waiting on a numbered message. call assert_equal('ok', ch_evalexpr(handle, 'call me')) call WaitFor('"we called you" == g:Ch_reply') - call assert_equal('we called you', g:Ch_reply) " Test that it works while not waiting on a numbered message. call ch_sendexpr(handle, 'call me again') call WaitFor('"we did call you" == g:Ch_reply') - call assert_equal('we did call you', g:Ch_reply) endfunc func Test_channel_handler() @@ -322,7 +320,6 @@ func Ch_channel_zero(port) call assert_equal('sent zero', ch_evalexpr(handle, 'send zero')) if s:has_handler call WaitFor('"zero index" == g:Ch_reply') - call assert_equal('zero index', g:Ch_reply) else sleep 20m call assert_equal('', g:Ch_reply) @@ -338,7 +335,6 @@ func Ch_channel_zero(port) else call assert_equal('', g:Ch_reply) endif - call assert_equal('sent zero', g:Ch_zero_reply) endfunc func Test_zero_reply() @@ -1468,7 +1464,7 @@ func Test_exit_callback_interval() let g:exit_cb_val = {'start': reltime(), 'end': 0, 'process': 0} let job = job_start([s:python, '-c', 'import time;time.sleep(0.5)'], {'exit_cb': 'MyExitTimeCb'}) let g:exit_cb_val.process = job_info(job).process - call WaitFor('type(g:exit_cb_val.end) != v:t_number || g:exit_cb_val.end != 0') + call WaitFor('type(g:exit_cb_val.end) != v:t_number || g:exit_cb_val.end != 0', 2000) let elapsed = reltimefloat(g:exit_cb_val.end) call assert_true(elapsed > 0.5) call assert_true(elapsed < 1.0)