Patch 8.2.3333
Problem: Vim9: not enough tests run with Vim9.
Solution: Run a few more tests in Vim9 script and :def function.
Files: src/testdir/test_listdict.vim, src/testdir/vim9.vim
*** ../vim-8.2.3332/src/testdir/test_listdict.vim 2021-08-11
21:49:19.626869328 +0200
--- src/testdir/test_listdict.vim 2021-08-11 22:26:20.555728714 +0200
***************
*** 457,462 ****
--- 457,475 ----
endfunc
let expected = 'a:' . string(get(d, 'func'))
call assert_equal(expected, d.func(string(remove(d, 'func'))))
+
+ " similar, in a way it also works in Vim9
+ let lines =<< trim END
+ VAR d = {1: 1, 2: 'x'}
+ func GetArg(a)
+ return "a:" .. a:a
+ endfunc
+ LET d.func = function('GetArg')
+ VAR expected = 'a:' .. string(get(d, 'func'))
+ call assert_equal(expected, d.func(string(remove(d, 'func'))))
+ END
+ call CheckTransLegacySuccess(lines)
+ call CheckTransVim9Success(lines)
endfunc
func Test_dict_literal_keys()
*** ../vim-8.2.3332/src/testdir/vim9.vim 2021-06-24 19:55:23.906419441
+0200
--- src/testdir/vim9.vim 2021-08-11 22:11:28.213771959 +0200
***************
*** 107,113 ****
CheckScriptFailure(['vim9script'] + lines, error, lnum + 1)
enddef
! " As CheckDefAndScriptFailure() but with two different exepected errors.
def CheckDefAndScriptFailure2(
lines: list<string>,
errorDef: string,
--- 107,113 ----
CheckScriptFailure(['vim9script'] + lines, error, lnum + 1)
enddef
! " As CheckDefAndScriptFailure() but with two different expected errors.
def CheckDefAndScriptFailure2(
lines: list<string>,
errorDef: string,
***************
*** 166,190 ****
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>)
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)
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
--- 166,210 ----
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>)
+ 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
*** ../vim-8.2.3332/src/version.c 2021-08-11 21:49:19.630869311 +0200
--- src/version.c 2021-08-11 22:12:19.901592897 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3333,
/**/
--
Did you ever stop to think... and forget to start again?
-- Steven Wright
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202108120839.17C8dhQ13155632%40masaka.moolenaar.net.