diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-08-12 10:39:10 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-08-12 10:39:10 +0200 |
commit | 3e9c0b9608736e7d888f3141443f8754143364d7 (patch) | |
tree | 123097cacec39d41bb9a20b95a030ba8f2e787bb /src/testdir/vim9.vim | |
parent | 4f0884d6e24d1d45ec83fd86b372b403177d3298 (diff) | |
download | vim-git-3e9c0b9608736e7d888f3141443f8754143364d7.tar.gz |
patch 8.2.3333: Vim9: not enough tests run with Vim9v8.2.3333
Problem: Vim9: not enough tests run with Vim9.
Solution: Run a few more tests in Vim9 script and :def function.
Diffstat (limited to 'src/testdir/vim9.vim')
-rw-r--r-- | src/testdir/vim9.vim | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/src/testdir/vim9.vim b/src/testdir/vim9.vim index cb66d4260..879d918be 100644 --- a/src/testdir/vim9.vim +++ b/src/testdir/vim9.vim @@ -107,7 +107,7 @@ def CheckDefAndScriptFailure(lines: list<string>, error: string, lnum = -3) 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,21 +166,31 @@ func CheckLegacyFailure(lines, error) endtry endfunc -" 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>) +" 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 @@ -188,6 +198,16 @@ enddef " Use 'VAR' for a declaration. " Use 'LET' for an assignment " Use ' #"' for a comment +def CheckLegacyAndVim9Success(lines: list<string>) + CheckTransLegacySuccess(lines) + CheckTransDefSuccess(lines) + CheckTransVim9Success(lines) +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 CheckLegacyAndVim9Failure(lines: list<string>, error: any) var legacyError: string var defError: string |