Mercurial > vim
comparison src/testdir/test_user_func.vim @ 32276:774c94489feb v9.0.1469
patch 9.0.1469: deferred functions not called from autocommands
Commit: https://github.com/vim/vim/commit/960cf9119e3f4922ca9719feb5e0c0bc5e3b9840
Author: zeertzjq <zeertzjq@outlook.com>
Date: Tue Apr 18 21:52:54 2023 +0100
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 https://github.com/vim/vim/issues/12267)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 18 Apr 2023 23:00:03 +0200 |
parents | 83caf07aedd6 |
children | f59ad8692734 |
comparison
equal
deleted
inserted
replaced
32275:07141765bae8 | 32276:774c94489feb |
---|---|
700 call assert_equal(['quit'], readfile('XQuitallDefThree')) | 700 call assert_equal(['quit'], readfile('XQuitallDefThree')) |
701 | 701 |
702 call delete('XQuitallDefThree') | 702 call delete('XQuitallDefThree') |
703 endfunc | 703 endfunc |
704 | 704 |
705 func Test_defer_quitall_autocmd() | |
706 let lines =<< trim END | |
707 autocmd User DeferAutocmdThree qa! | |
708 | |
709 func DeferLevelTwo() | |
710 call writefile(['text'], 'XQuitallAutocmdTwo', 'D') | |
711 doautocmd User DeferAutocmdThree | |
712 endfunc | |
713 | |
714 autocmd User DeferAutocmdTwo ++nested call DeferLevelTwo() | |
715 | |
716 def DeferLevelOne() | |
717 call writefile(['text'], 'XQuitallAutocmdOne', 'D') | |
718 doautocmd User DeferAutocmdTwo | |
719 enddef | |
720 | |
721 autocmd User DeferAutocmdOne ++nested call DeferLevelOne() | |
722 | |
723 doautocmd User DeferAutocmdOne | |
724 END | |
725 call writefile(lines, 'XdeferQuitallAutocmd', 'D') | |
726 let res = system(GetVimCommand() .. ' -X -S XdeferQuitallAutocmd') | |
727 call assert_equal(0, v:shell_error) | |
728 call assert_false(filereadable('XQuitallAutocmdOne')) | |
729 call assert_false(filereadable('XQuitallAutocmdTwo')) | |
730 endfunc | |
731 | |
705 func Test_defer_quitall_in_expr_func() | 732 func Test_defer_quitall_in_expr_func() |
706 let lines =<< trim END | 733 let lines =<< trim END |
707 def DefIndex(idx: number, val: string): bool | 734 def DefIndex(idx: number, val: string): bool |
708 call writefile([idx .. ': ' .. val], 'Xentry' .. idx, 'D') | 735 call writefile([idx .. ': ' .. val], 'Xentry' .. idx, 'D') |
709 if val == 'b' | 736 if val == 'b' |