diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-10-19 18:34:48 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-19 18:34:48 +0800 |
commit | a0961659770ca41edcb5a6dcf28e7c7492eb60f0 (patch) | |
tree | f6259a11fa53bf2166db37b31206def27076bd5d /test | |
parent | ae7020c667b5314fe832d2a8897fb16d57194bdf (diff) | |
download | rneovim-a0961659770ca41edcb5a6dcf28e7c7492eb60f0.tar.gz rneovim-a0961659770ca41edcb5a6dcf28e7c7492eb60f0.tar.bz2 rneovim-a0961659770ca41edcb5a6dcf28e7c7492eb60f0.zip |
vim-patch:9.0.2050: Vim9: crash with deferred function call and exception (#25715)
Problem: Vim9: crash with deferred function call and exception
Solution: Save and restore exception state
Crash when a deferred function is called after an exception and another
exception is thrown
closes: vim/vim#13376
closes: vim/vim#13377
https://github.com/vim/vim/commit/c59c1e0d88651a71ece7366e418f1253abbe2a28
The change in check_due_timer() is N/A as Nvim calls timer callbacks on
the main loop.
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/old/testdir/test_user_func.vim | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/test/old/testdir/test_user_func.vim b/test/old/testdir/test_user_func.vim index ee1fd4ec5b..d65f70445d 100644 --- a/test/old/testdir/test_user_func.vim +++ b/test/old/testdir/test_user_func.vim @@ -796,11 +796,21 @@ endfunc " Test for calling a deferred function after an exception func Test_defer_after_exception() let g:callTrace = [] + func Bar() + let g:callTrace += [1] + throw 'InnerException' + endfunc + func Defer() - let g:callTrace += ['a'] - let g:callTrace += ['b'] - let g:callTrace += ['c'] - let g:callTrace += ['d'] + let g:callTrace += [2] + let g:callTrace += [3] + try + call Bar() + catch /InnerException/ + let g:callTrace += [4] + endtry + let g:callTrace += [5] + let g:callTrace += [6] endfunc func Foo() @@ -811,9 +821,9 @@ func Test_defer_after_exception() try call Foo() catch /TestException/ - let g:callTrace += ['e'] + let g:callTrace += [7] endtry - call assert_equal(['a', 'b', 'c', 'd', 'e'], g:callTrace) + call assert_equal([2, 3, 1, 4, 5, 6, 7], g:callTrace) delfunc Defer delfunc Foo |