comparison src/testdir/test_channel.vim @ 29216:32f3b86352e6 v8.2.5127

patch 8.2.5127: using assert_true() does not show value on failure Commit: https://github.com/vim/vim/commit/cdc6a43559d5b880f81efceb849f40c20af1ada1 Author: zeertzjq <zeertzjq@outlook.com> Date: Sun Jun 19 11:45:46 2022 +0100 patch 8.2.5127: using assert_true() does not show value on failure Problem: Using assert_true() does not show value on failure. Solution: Use assert_inrange(). (closes https://github.com/vim/vim/issues/10593)
author Bram Moolenaar <Bram@vim.org>
date Sun, 19 Jun 2022 13:00:05 +0200
parents 6b1da12297e5
children 0b47ef4e19b8
comparison
equal deleted inserted replaced
29215:9a23a8dec93f 29216:32f3b86352e6
526 if ch_status(handle) != "fail" 526 if ch_status(handle) != "fail"
527 " Oops, port does exists. 527 " Oops, port does exists.
528 call ch_close(handle) 528 call ch_close(handle)
529 else 529 else
530 let elapsed = reltime(start) 530 let elapsed = reltime(start)
531 call assert_true(reltimefloat(elapsed) < 1.0) 531 call assert_inrange(0.0, 1.0, reltimefloat(elapsed))
532 endif 532 endif
533 533
534 " We intend to use a socket that doesn't exist and wait for half a second 534 " We intend to use a socket that doesn't exist and wait for half a second
535 " before giving up. If the socket does exist it can fail in various ways. 535 " before giving up. If the socket does exist it can fail in various ways.
536 " Check for "Connection reset by peer" to avoid flakiness. 536 " Check for "Connection reset by peer" to avoid flakiness.
1632 let g:exit_cb_val = {'start': reltime(), 'end': 0, 'process': 0} 1632 let g:exit_cb_val = {'start': reltime(), 'end': 0, 'process': 0}
1633 let job = [s:python, '-c', 'import time;time.sleep(0.5)']->job_start({'exit_cb': 'MyExitTimeCb'}) 1633 let job = [s:python, '-c', 'import time;time.sleep(0.5)']->job_start({'exit_cb': 'MyExitTimeCb'})
1634 let g:exit_cb_val.process = job_info(job).process 1634 let g:exit_cb_val.process = job_info(job).process
1635 call WaitFor('type(g:exit_cb_val.end) != v:t_number || g:exit_cb_val.end != 0') 1635 call WaitFor('type(g:exit_cb_val.end) != v:t_number || g:exit_cb_val.end != 0')
1636 let elapsed = reltimefloat(g:exit_cb_val.end) 1636 let elapsed = reltimefloat(g:exit_cb_val.end)
1637 call assert_true(elapsed > 0.5) 1637 call assert_inrange(0.5, 1.0, elapsed)
1638 call assert_true(elapsed < 1.0)
1639 1638
1640 " case: unreferenced job, using timer 1639 " case: unreferenced job, using timer
1641 if !has('timers') 1640 if !has('timers')
1642 return 1641 return
1643 endif 1642 endif