summaryrefslogtreecommitdiff
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-01-29 20:36:56 +0100
committerBram Moolenaar <Bram@vim.org>2019-01-29 20:36:56 +0100
commit50948e4ac24314d5a70404bbc592ffc28755ad9f (patch)
treebdbd6a06b8957ab794a9ebe5a4cb2404175febe5 /src/testdir
parente0de2164f62a1736cdc64dbf804b77db8af90c10 (diff)
downloadvim-git-50948e4ac24314d5a70404bbc592ffc28755ad9f.tar.gz
patch 8.1.0844: when timer fails test will hang foreverv8.1.0844
Problem: When timer fails test will hang forever. Solution: Use reltime() to limit waiting time. (Ozaki Kiichi, closes #3878)
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_timers.vim4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/testdir/test_timers.vim b/src/testdir/test_timers.vim
index 2cea3e47d..78ec00567 100644
--- a/src/testdir/test_timers.vim
+++ b/src/testdir/test_timers.vim
@@ -257,9 +257,11 @@ func Test_getchar_zero()
return
endif
+ " Measure the elapsed time to avoid a hang when it fails.
+ let start = reltime()
let id = timer_start(20, {id -> feedkeys('x', 'L')})
let c = 0
- while c == 0
+ while c == 0 && reltimefloat(reltime(start)) < 0.2
let c = getchar(0)
sleep 10m
endwhile