Mercurial > vim
comparison src/testdir/test_user_func.vim @ 32262:854aeaac48b7 v9.0.1462
patch 9.0.1462: recursively calling :defer function if it does :qa
Commit: https://github.com/vim/vim/commit/42994bf678f46dc9ca66e49f512261da8864fff6
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Apr 17 19:23:45 2023 +0100
patch 9.0.1462: recursively calling :defer function if it does :qa
Problem: Recursively calling :defer function if it does :qa.
Solution: Clear the defer entry before calling the function. (closes https://github.com/vim/vim/issues/12266)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 17 Apr 2023 20:30:07 +0200 |
parents | aa45593ec2ca |
children | 83caf07aedd6 |
comparison
equal
deleted
inserted
replaced
32261:8f47c6cfe513 | 32262:854aeaac48b7 |
---|---|
654 func Test_defer_quitall() | 654 func Test_defer_quitall() |
655 let lines =<< trim END | 655 let lines =<< trim END |
656 vim9script | 656 vim9script |
657 func DeferLevelTwo() | 657 func DeferLevelTwo() |
658 call writefile(['text'], 'XQuitallTwo', 'D') | 658 call writefile(['text'], 'XQuitallTwo', 'D') |
659 call writefile(['quit'], 'XQuitallThree', 'a') | |
659 qa! | 660 qa! |
660 endfunc | 661 endfunc |
661 | 662 |
662 def DeferLevelOne() | 663 def DeferLevelOne() |
663 call writefile(['text'], 'XQuitallOne', 'D') | 664 call writefile(['text'], 'XQuitallOne', 'D') |
669 call writefile(lines, 'XdeferQuitall', 'D') | 670 call writefile(lines, 'XdeferQuitall', 'D') |
670 let res = system(GetVimCommand() .. ' -X -S XdeferQuitall') | 671 let res = system(GetVimCommand() .. ' -X -S XdeferQuitall') |
671 call assert_equal(0, v:shell_error) | 672 call assert_equal(0, v:shell_error) |
672 call assert_false(filereadable('XQuitallOne')) | 673 call assert_false(filereadable('XQuitallOne')) |
673 call assert_false(filereadable('XQuitallTwo')) | 674 call assert_false(filereadable('XQuitallTwo')) |
675 call assert_equal(['quit'], readfile('XQuitallThree')) | |
676 | |
677 call delete('XQuitallThree') | |
674 endfunc | 678 endfunc |
675 | 679 |
676 func Test_defer_quitall_in_expr_func() | 680 func Test_defer_quitall_in_expr_func() |
677 let lines =<< trim END | 681 let lines =<< trim END |
678 def DefIndex(idx: number, val: string): bool | 682 def DefIndex(idx: number, val: string): bool |