From d8f64267141ec560cf712497f953b2057b708b31 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 8 Jul 2022 10:21:27 +0800 Subject: [PATCH] vim-patch:8.1.1867: still a timer test that is flaky on Mac Problem: Still a timer test that is flaky on Mac. Solution: Loop with a sleep instead of one fixed sleep. https://github.com/vim/vim/commit/315244d85b9b8faae549b1700e8cc2e45eaa68ea --- src/nvim/testdir/test_timers.vim | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim index eea27e4b90..3dd97c8081 100644 --- a/src/nvim/testdir/test_timers.vim +++ b/src/nvim/testdir/test_timers.vim @@ -160,8 +160,16 @@ endfunc func Test_timer_stop_in_callback() call assert_equal(0, len(timer_info())) let g:timer1 = timer_start(10, 'StopTimer1') - sleep 50m - call assert_equal(0, len(timer_info())) + let slept = 0 + for i in range(10) + if len(timer_info()) == 0 + break + endif + sleep 10m + let slept += 10 + endfor + " This should take only 30 msec, but on Mac it's often longer + call assert_inrange(0, 50, slept) endfunc func StopTimerAll(timer)