aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-04-19 07:59:35 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-04-19 08:09:46 +0800
commita0c982671ee2f4c4e87a6480d2ea4d23ba807273 (patch)
tree7067cacec0c072c6289a2f3a2b417775ef47e491 /test
parenta11849abdf7eeb33423be2ee920c7b504379b39b (diff)
downloadrneovim-a0c982671ee2f4c4e87a6480d2ea4d23ba807273.tar.gz
rneovim-a0c982671ee2f4c4e87a6480d2ea4d23ba807273.tar.bz2
rneovim-a0c982671ee2f4c4e87a6480d2ea4d23ba807273.zip
vim-patch:9.0.1469: deferred functions not called from autocommands
Problem: Deferred functions not called from autocommands. Solution: Also go through the funccal_stack. (closes vim/vim#12267) https://github.com/vim/vim/commit/960cf9119e3f4922ca9719feb5e0c0bc5e3b9840
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_user_func.vim29
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 d8e36cefe4..5f6229258d 100644
--- a/test/old/testdir/test_user_func.vim
+++ b/test/old/testdir/test_user_func.vim
@@ -661,6 +661,35 @@ func Test_defer_quitall_def()
call delete('XQuitallDefThree')
endfunc
+func Test_defer_quitall_autocmd()
+ let lines =<< trim END
+ autocmd User DeferAutocmdThree qa!
+
+ func DeferLevelTwo()
+ call writefile(['text'], 'XQuitallAutocmdTwo', 'D')
+ doautocmd User DeferAutocmdThree
+ endfunc
+
+ autocmd User DeferAutocmdTwo ++nested call DeferLevelTwo()
+
+ " def DeferLevelOne()
+ func DeferLevelOne()
+ call writefile(['text'], 'XQuitallAutocmdOne', 'D')
+ doautocmd User DeferAutocmdTwo
+ " enddef
+ endfunc
+
+ autocmd User DeferAutocmdOne ++nested call DeferLevelOne()
+
+ doautocmd User DeferAutocmdOne
+ END
+ call writefile(lines, 'XdeferQuitallAutocmd', 'D')
+ let res = system(GetVimCommand() .. ' -X -S XdeferQuitallAutocmd')
+ call assert_equal(0, v:shell_error)
+ call assert_false(filereadable('XQuitallAutocmdOne'))
+ call assert_false(filereadable('XQuitallAutocmdTwo'))
+endfunc
+
func Test_defer_quitall_in_expr_func()
throw 'Skipped: Vim9 script is N/A'
let lines =<< trim END