forked from aniani/vim
patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Problem: Vim9: "break" inside try/catch not handled correctly. Solution: First jump to :endtry. (closes #9927)
This commit is contained in:
@@ -907,6 +907,28 @@ def Test_continue_in_try_in_while()
|
||||
unlet g:sequence
|
||||
enddef
|
||||
|
||||
def Test_break_in_try_in_for()
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
def Ls(): list<string>
|
||||
var ls: list<string>
|
||||
for s in ['abc', 'def']
|
||||
for _ in [123, 456]
|
||||
try
|
||||
eval [][0]
|
||||
catch
|
||||
break
|
||||
endtry
|
||||
endfor
|
||||
ls += [s]
|
||||
endfor
|
||||
return ls
|
||||
enddef
|
||||
assert_equal(['abc', 'def'], Ls())
|
||||
END
|
||||
v9.CheckScriptSuccess(lines)
|
||||
enddef
|
||||
|
||||
def Test_nocatch_return_in_try()
|
||||
# return in try block returns normally
|
||||
def ReturnInTry(): string
|
||||
|
Reference in New Issue
Block a user