diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-04-17 08:56:23 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-04-17 09:08:08 +0800 |
commit | 6bfba3660c5fbb22104cd87bd66a1381007fca22 (patch) | |
tree | 354d2833c46402470c3c09fdd9e6a6f4bcd57e1c /test | |
parent | 78535664bd29e6f2bd4b64c20cb29ef40f9bccd4 (diff) | |
download | rneovim-6bfba3660c5fbb22104cd87bd66a1381007fca22.tar.gz rneovim-6bfba3660c5fbb22104cd87bd66a1381007fca22.tar.bz2 rneovim-6bfba3660c5fbb22104cd87bd66a1381007fca22.zip |
vim-patch:9.0.0406: deferred functions not invoked when partial func exits
Problem: Deferred functions not invoked when partial func exits.
Solution: Create a funccall_T when calling a :def function.
https://github.com/vim/vim/commit/9667b2c888351b04751bdb43cba0d4ffc8c13ab1
The remove_funccal() function is currently unused, but it will be used
in patch 9.0.0618.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/old/testdir/test_user_func.vim | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/old/testdir/test_user_func.vim b/test/old/testdir/test_user_func.vim index 4bb4078a1c..5a1931e690 100644 --- a/test/old/testdir/test_user_func.vim +++ b/test/old/testdir/test_user_func.vim @@ -633,5 +633,34 @@ func Test_defer_quitall() call assert_false(filereadable('XQuitallTwo')) endfunc +func Test_defer_quitall_in_expr_func() + throw 'Skipped: Vim9 script is N/A' + let lines =<< trim END + def DefIndex(idx: number, val: string): bool + call writefile([idx .. ': ' .. val], 'Xentry' .. idx, 'D') + if val == 'b' + qa! + endif + return val == 'c' + enddef + + def Test_defer_in_funcref() + assert_equal(2, indexof(['a', 'b', 'c'], funcref('g:DefIndex'))) + enddef + call Test_defer_in_funcref() + END + call writefile(lines, 'XdeferQuitallExpr', 'D') + let res = system(GetVimCommandClean() .. ' -X -S XdeferQuitallExpr') + call assert_equal(0, v:shell_error) + call assert_false(filereadable('Xentry0')) + call assert_false(filereadable('Xentry1')) + call assert_false(filereadable('Xentry2')) +endfunc + +func FuncIndex(idx, val) + call writefile([a:idx .. ': ' .. a:val], 'Xentry' .. a:idx, 'D') + return a:val == 'c' +endfunc + " vim: shiftwidth=2 sts=2 expandtab |