@@ -2943,6 +2943,30 @@ def Test_nested_closure_fails()
29432943 v9.CheckScriptFailure (lines , ' E1012:' )
29442944enddef
29452945
2946+ def Run_Test_closure_in_for_loop_fails ()
2947+ var lines = << trim END
2948+ vim9script
2949+ for n in [0 ]
2950+ timer_start (10 , (_) = > {
2951+ echo n
2952+ })
2953+ endfor
2954+ END
2955+ writefile (lines , ' XTest_closure_fails' , ' D' )
2956+
2957+ # Check that an error shows
2958+ var buf = g: RunVimInTerminal (' -S XTest_closure_fails' , {' rows' : 6 })
2959+ g: VerifyScreenDump (buf , ' Test_vim9_closure_fails' , {})
2960+
2961+ # clean up
2962+ g: StopVimInTerminal (buf )
2963+ enddef
2964+
2965+ func Test_closure_in_for_loop_fails ()
2966+ CheckScreendump
2967+ call Run_Test_closure_in_for_loop_fails ()
2968+ endfunc
2969+
29462970def Test_global_closure ()
29472971 var lines = << trim END
29482972 vim9script
@@ -3321,7 +3345,7 @@ def Run_Test_silent_echo()
33213345 enddef
33223346 defcompile
33233347 END
3324- writefile (lines , ' XTest_silent_echo' )
3348+ writefile (lines , ' XTest_silent_echo' , ' D ' )
33253349
33263350 # Check that the balloon shows up after a mouse move
33273351 var buf = g: RunVimInTerminal (' -S XTest_silent_echo' , {' rows' : 6 })
@@ -3330,7 +3354,6 @@ def Run_Test_silent_echo()
33303354
33313355 # clean up
33323356 g: StopVimInTerminal (buf )
3333- delete (' XTest_silent_echo' )
33343357enddef
33353358
33363359def SilentlyError ()
0 commit comments