0
0
mirror of https://github.com/vim/vim.git synced 2025-10-02 05:04:20 -04:00

patch 8.2.2370: Vim9: command fails in catch block

Problem:    Vim9: command fails in catch block.
Solution:   Reset force_abort and need_rethrow. (closes #7692)
This commit is contained in:
Bram Moolenaar
2021-01-17 19:20:32 +01:00
parent 3af15ab788
commit 1430ceeb2d
3 changed files with 40 additions and 0 deletions

View File

@@ -558,6 +558,43 @@ def Test_try_catch_throw()
assert_equal(411, n)
enddef
def Test_cnext_works_in_catch()
var lines =<< trim END
vim9script
au BufEnter * eval 0
writefile(['text'], 'Xfile1')
writefile(['text'], 'Xfile2')
var items = [
{lnum: 1, filename: 'Xfile1', valid: true},
{lnum: 1, filename: 'Xfile2', valid: true}
]
setqflist([], ' ', {items: items})
cwindow
def CnextOrCfirst()
# if cnext fails, cfirst is used
try
cnext
catch
cfirst
endtry
enddef
CnextOrCfirst()
CnextOrCfirst()
writefile([getqflist({idx: 0}).idx], 'Xresult')
qall
END
writefile(lines, 'XCatchCnext')
RunVim([], [], '--clean -S XCatchCnext')
assert_equal(['1'], readfile('Xresult'))
delete('Xfile1')
delete('Xfile2')
delete('XCatchCnext')
delete('Xresult')
enddef
def Test_throw_skipped()
if 0
throw dontgethere