To: vim_dev@googlegroups.com Subject: Patch 8.2.3333 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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, errorDef: string, --- 107,113 ---- CheckScriptFailure(['vim9script'] + lines, error, lnum + 1) enddef ! " As CheckDefAndScriptFailure() but with two different expected errors. def CheckDefAndScriptFailure2( lines: list, 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) var legacylines = lines->mapnew((_, v) => v->substitute('\', 'let', 'g') ->substitute('\', 'let', 'g') ->substitute('#"', ' "', 'g')) CheckLegacySuccess(legacylines) var vim9lines = lines->mapnew((_, v) => v->substitute('\', 'var', 'g') ->substitute('\) var legacylines = lines->mapnew((_, v) => v->substitute('\', 'let', 'g') ->substitute('\', 'let', 'g') ->substitute('#"', ' "', 'g')) CheckLegacySuccess(legacylines) + enddef + " Execute "lines" in a :def function, translated as in + " CheckLegacyAndVim9Success() + def CheckTransDefSuccess(lines: list) var vim9lines = lines->mapnew((_, v) => v->substitute('\', 'var', 'g') ->substitute('\) + var vim9lines = lines->mapnew((_, v) => + v->substitute('\', 'var', 'g') + ->substitute('\) + 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 -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///