diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2019-04-10 00:50:51 +0200 |
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2019-04-10 00:50:51 +0200 |
| commit | 9d085c75ff427bf0ccc408983ce7b68f0a2b284d (patch) | |
| tree | 66ff0f2aa1cd79ef8ec19f80ab473d7be770cd60 /src/nvim/testdir | |
| parent | ae2401621abbf530f5abd1ad8ce822b739b02cc4 (diff) | |
| download | rneovim-9d085c75ff427bf0ccc408983ce7b68f0a2b284d.tar.gz rneovim-9d085c75ff427bf0ccc408983ce7b68f0a2b284d.tar.bz2 rneovim-9d085c75ff427bf0ccc408983ce7b68f0a2b284d.zip | |
vim-patch:8.0.0702: error in a timer can make Vim unusable #9826
Problem: An error in a timer can make Vim unusable.
Solution: Don't set the error flag or exception from a timer. Stop a timer
if it causes an error 3 out of 3 times. Discard an exception
caused inside a timer.
https://github.com/vim/vim/commit/c577d813b7978345dec4310b2d8f5d5624a681f6
closes #9826
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_timers.vim | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim index fe5d61fad4..5b5f001e6b 100644 --- a/src/nvim/testdir/test_timers.vim +++ b/src/nvim/testdir/test_timers.vim @@ -200,6 +200,23 @@ func Test_input_in_timer() call assert_equal('hello', g:val) endfunc +func FuncWithError(timer) + let g:call_count += 1 + if g:call_count == 4 + return + endif + doesnotexist +endfunc + +func Test_timer_errors() + let g:call_count = 0 + let timer = timer_start(10, 'FuncWithError', {'repeat': -1}) + " Timer will be stopped after failing 3 out of 3 times. + call WaitFor('g:call_count == 3') + sleep 50m + call assert_equal(3, g:call_count) +endfunc + func FuncWithCaughtError(timer) let g:call_count += 1 try |