mirror of
https://github.com/vim/vim.git
synced 2025-10-01 04:54:07 -04:00
patch 8.2.3077: Vim9: an error in a catch block is not reported
Problem: Vim9: an error in a catch block is not reported. Solution: Put the "in catch" flag in the try stack. (closes #8478)
This commit is contained in:
@@ -631,6 +631,17 @@ def Test_try_in_catch()
|
||||
END
|
||||
enddef
|
||||
|
||||
def Test_error_in_catch()
|
||||
var lines =<< trim END
|
||||
try
|
||||
eval [][0]
|
||||
catch /E684:/
|
||||
eval [][0]
|
||||
endtry
|
||||
END
|
||||
CheckDefExecFailure(lines, 'E684:', 4)
|
||||
enddef
|
||||
|
||||
" :while at the very start of a function that :continue jumps to
|
||||
def TryContinueFunc()
|
||||
while g:Count < 2
|
||||
@@ -768,6 +779,30 @@ def Test_try_catch_nested()
|
||||
|
||||
assert_equal('intry', ReturnFinally())
|
||||
assert_equal('finally', g:in_finally)
|
||||
|
||||
var l = []
|
||||
try
|
||||
l->add('1')
|
||||
throw 'bad'
|
||||
l->add('x')
|
||||
catch /bad/
|
||||
l->add('2')
|
||||
try
|
||||
l->add('3')
|
||||
throw 'one'
|
||||
l->add('x')
|
||||
catch /one/
|
||||
l->add('4')
|
||||
try
|
||||
l->add('5')
|
||||
throw 'more'
|
||||
l->add('x')
|
||||
catch /more/
|
||||
l->add('6')
|
||||
endtry
|
||||
endtry
|
||||
endtry
|
||||
assert_equal(['1', '2', '3', '4', '5', '6'], l)
|
||||
enddef
|
||||
|
||||
def TryOne(): number
|
||||
|
Reference in New Issue
Block a user