@@ -107,7 +107,7 @@ def CheckDefAndScriptFailure(lines: list<string>, error: string, lnum = -3)
107107 CheckScriptFailure ([' vim9script' ] + lines , error , lnum + 1 )
108108enddef
109109
110- " As CheckDefAndScriptFailure() but with two different exepected errors.
110+ " As CheckDefAndScriptFailure() but with two different expected errors.
111111def CheckDefAndScriptFailure2 (
112112 lines : list <string> ,
113113 errorDef: string ,
@@ -166,24 +166,44 @@ func CheckLegacyFailure(lines, error)
166166 endtry
167167endfunc
168168
169- " Execute "lines" in a legacy function, :def function and Vim9 script.
170- " Use 'VAR' for a declaration.
171- " Use 'LET' for an assignment
172- " Use ' #"' for a comment
173- def CheckLegacyAndVim9Success (lines : list <string> )
169+ " Execute "lines" in a legacy function, translated as in
170+ " CheckLegacyAndVim9Success()
171+ def CheckTransLegacySuccess (lines : list <string> )
174172 var legacylines = lines - >mapnew ((_, v ) = >
175173 v - >substitute (' \<VAR\>' , ' let' , ' g' )
176174 - >substitute (' \<LET\>' , ' let' , ' g' )
177175 - >substitute (' #"' , ' "' , ' g' ))
178176 CheckLegacySuccess (legacylines)
177+ enddef
179178
179+ " Execute "lines" in a :def function, translated as in
180+ " CheckLegacyAndVim9Success()
181+ def CheckTransDefSuccess (lines : list <string> )
180182 var vim9lines = lines - >mapnew ((_, v ) = >
181183 v - >substitute (' \<VAR\>' , ' var' , ' g' )
182184 - >substitute (' \<LET ' , ' ' , ' g' ))
183185 CheckDefSuccess (vim9lines)
186+ enddef
187+
188+ " Execute "lines" in a Vim9 script, translated as in
189+ " CheckLegacyAndVim9Success()
190+ def CheckTransVim9Success (lines : list <string> )
191+ var vim9lines = lines - >mapnew ((_, v ) = >
192+ v - >substitute (' \<VAR\>' , ' var' , ' g' )
193+ - >substitute (' \<LET ' , ' ' , ' g' ))
184194 CheckScriptSuccess ([' vim9script' ] + vim9lines)
185195enddef
186196
197+ " Execute "lines" in a legacy function, :def function and Vim9 script.
198+ " Use 'VAR' for a declaration.
199+ " Use 'LET' for an assignment
200+ " Use ' #"' for a comment
201+ def CheckLegacyAndVim9Success (lines : list <string> )
202+ CheckTransLegacySuccess (lines )
203+ CheckTransDefSuccess (lines )
204+ CheckTransVim9Success (lines )
205+ enddef
206+
187207" Execute "lines" in a legacy function, :def function and Vim9 script.
188208" Use 'VAR' for a declaration.
189209" Use 'LET' for an assignment
0 commit comments