aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/shared.vim
diff options
context:
space:
mode:
authorJurica Bradaric <jurica.bradaric@avl.com>2017-03-05 16:25:40 +0100
committerJurica Bradaric <jbradaric@gmail.com>2017-03-20 21:15:56 +0100
commit5b8ce2feed6b528bae4bceba6f234be000949971 (patch)
tree2763d110839192b2130a72d7f78b0bddf6f6b519 /src/nvim/testdir/shared.vim
parent8924e75f3477b20f0ef4e3df64b56bf496b197ae (diff)
downloadrneovim-5b8ce2feed6b528bae4bceba6f234be000949971.tar.gz
rneovim-5b8ce2feed6b528bae4bceba6f234be000949971.tar.bz2
rneovim-5b8ce2feed6b528bae4bceba6f234be000949971.zip
vim-patch:7.4.2180
Problem: There is no easy way to stop all timers. There is no way to temporary pause a timer. Solution: Add timer_stopall() and timer_pause(). https://github.com/vim/vim/commit/b73598e2f022a22fec512ea681c70d2775e8fd87
Diffstat (limited to 'src/nvim/testdir/shared.vim')
-rw-r--r--src/nvim/testdir/shared.vim17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/nvim/testdir/shared.vim b/src/nvim/testdir/shared.vim
new file mode 100644
index 0000000000..9573f5a9c3
--- /dev/null
+++ b/src/nvim/testdir/shared.vim
@@ -0,0 +1,17 @@
+" Functions shared by several tests.
+
+" Wait for up to a second for "expr" to become true.
+" Return time slept in milliseconds.
+func WaitFor(expr)
+ let slept = 0
+ for i in range(100)
+ try
+ if eval(a:expr)
+ return slept
+ endif
+ catch
+ endtry
+ let slept += 10
+ sleep 10m
+ endfor
+endfunc