diff src/testdir/vim9.vim @ 25593:c6277019b8c1 v8.2.3333

patch 8.2.3333: Vim9: not enough tests run with Vim9 Commit: https://github.com/vim/vim/commit/3e9c0b9608736e7d888f3141443f8754143364d7 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 12 10:39:10 2021 +0200 patch 8.2.3333: Vim9: not enough tests run with Vim9 Problem: Vim9: not enough tests run with Vim9. Solution: Run a few more tests in Vim9 script and :def function.
author Bram Moolenaar <Bram@vim.org>
date Thu, 12 Aug 2021 10:45:02 +0200
parents e321dbddc076
children 0fdacd8f0cf3
line wrap: on
line diff
--- a/src/testdir/vim9.vim
+++ b/src/testdir/vim9.vim
@@ -107,7 +107,7 @@ def CheckDefAndScriptFailure(lines: list
   CheckScriptFailure(['vim9script'] + lines, error, lnum + 1)
 enddef
 
-" As CheckDefAndScriptFailure() but with two different exepected errors.
+" As CheckDefAndScriptFailure() but with two different expected errors.
 def CheckDefAndScriptFailure2(
   	lines: list<string>,
 	errorDef: string,
@@ -166,22 +166,42 @@ func CheckLegacyFailure(lines, error)
   endtry
 endfunc
 
+" Execute "lines" in a legacy function, translated as in
+" CheckLegacyAndVim9Success()
+def CheckTransLegacySuccess(lines: list<string>)
+  var legacylines = lines->mapnew((_, v) =>
+  				v->substitute('\<VAR\>', 'let', 'g')
+		           	 ->substitute('\<LET\>', 'let', 'g')
+		           	 ->substitute('#"', ' "', 'g'))
+  CheckLegacySuccess(legacylines)
+enddef
+
+" Execute "lines" in a :def function, translated as in
+" CheckLegacyAndVim9Success()
+def CheckTransDefSuccess(lines: list<string>)
+  var vim9lines = lines->mapnew((_, v) =>
+  				v->substitute('\<VAR\>', 'var', 'g')
+		           	 ->substitute('\<LET ', '', 'g'))
+  CheckDefSuccess(vim9lines)
+enddef
+
+" Execute "lines" in a Vim9 script, translated as in
+" CheckLegacyAndVim9Success()
+def CheckTransVim9Success(lines: list<string>)
+  var vim9lines = lines->mapnew((_, v) =>
+  				v->substitute('\<VAR\>', 'var', 'g')
+		           	 ->substitute('\<LET ', '', 'g'))
+  CheckScriptSuccess(['vim9script'] + vim9lines)
+enddef
+
 " Execute "lines" in a legacy function, :def function and Vim9 script.
 " Use 'VAR' for a declaration.
 " Use 'LET' for an assignment
 " Use ' #"' for a comment
 def CheckLegacyAndVim9Success(lines: list<string>)
-  var legacylines = lines->mapnew((_, v) =>
-  				v->substitute('\<VAR\>', 'let', 'g')
-		           	 ->substitute('\<LET\>', 'let', 'g')
-		           	 ->substitute('#"', ' "', 'g'))
-  CheckLegacySuccess(legacylines)
-
-  var vim9lines = lines->mapnew((_, v) =>
-  				v->substitute('\<VAR\>', 'var', 'g')
-		           	 ->substitute('\<LET ', '', 'g'))
-  CheckDefSuccess(vim9lines)
-  CheckScriptSuccess(['vim9script'] + vim9lines)
+  CheckTransLegacySuccess(lines)
+  CheckTransDefSuccess(lines)
+  CheckTransVim9Success(lines)
 enddef
 
 " Execute "lines" in a legacy function, :def function and Vim9 script.