diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-01-29 21:45:34 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-29 21:45:34 +0000 |
commit | 62aec93bfdb9e1b40d03a6d2e8e9511f8b1bdb2d (patch) | |
tree | 8f2962626c458f5ac5fa1f2ec46e79248683c81d | |
parent | 135e15251efd96c960e51e8ab31333c2d6887983 (diff) |
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistentv8.2.4257
Problem: Vim9: finding global function without g: prefix but not finding
global variable is inconsistent.
Solution: Require using g: for a global function. Change the vim9.vim
script into a Vim9 script with exports. Fix that import in legacy
script does not work.
34 files changed, 3235 insertions, 3199 deletions
diff --git a/src/eval.c b/src/eval.c index 86f103b94a..c2357884af 100644 --- a/src/eval.c +++ b/src/eval.c @@ -963,7 +963,7 @@ get_lval( if (lp->ll_name == NULL) return p; - if (*p == '.' && in_vim9script()) + if (*p == '.') { imported_T *import = find_imported(lp->ll_name, p - lp->ll_name, TRUE, NULL); diff --git a/src/evalfunc.c b/src/evalfunc.c index cb5fcfe025..711e2e6c0a 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -3830,14 +3830,7 @@ f_exists(typval_T *argvars, typval_T *rettv) } else if (*p == '*') // internal or user defined function { - int save_version = current_sctx.sc_version; - - // Vim9 script assumes a function is script-local, but here we want to - // find any matching function. - if (current_sctx.sc_version == SCRIPT_VERSION_VIM9) - current_sctx.sc_version = SCRIPT_VERSION_MAX; n = function_exists(p + 1, FALSE); - current_sctx.sc_version = save_version; } else if (*p == '?') // internal function only { diff --git a/src/testdir/test_blob.vim b/src/testdir/test_blob.vim index 69c86963cd..e8bc2c9dad 100644 --- a/src/testdir/test_blob.vim +++ b/src/testdir/test_blob.vim @@ -1,6 +1,6 @@ " Tests for the Blob types -source vim9.vim +import './vim9.vim' as v9 func TearDown() " Run garbage collection after every test @@ -39,7 +39,7 @@ func Test_blob_create() call assert_equal(0, len(test_null_blob())) call assert_equal(0z, copy(test_null_blob())) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) endfunc " assignment to a blob @@ -75,49 +75,49 @@ func Test_blob_assign() VAR m = deepcopy(l) LET m[0] = 0z34 #" E742 or E741 should not occur. END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) let lines =<< trim END VAR b = 0zDEADBEEF LET b[2 : 3] = 0z112233 END - call CheckLegacyAndVim9Failure(lines, 'E972:') + call v9.CheckLegacyAndVim9Failure(lines, 'E972:') let lines =<< trim END VAR b = 0zDEADBEEF LET b[2 : 3] = 0z11 END - call CheckLegacyAndVim9Failure(lines, 'E972:') + call v9.CheckLegacyAndVim9Failure(lines, 'E972:') let lines =<< trim END VAR b = 0zDEADBEEF LET b[3 : 2] = 0z END - call CheckLegacyAndVim9Failure(lines, 'E979:') + call v9.CheckLegacyAndVim9Failure(lines, 'E979:') let lines =<< trim END VAR b = 0zDEADBEEF LET b ..= 0z33 END - call CheckLegacyAndVim9Failure(lines, ['E734:', 'E1019:', 'E734:']) + call v9.CheckLegacyAndVim9Failure(lines, ['E734:', 'E1019:', 'E734:']) let lines =<< trim END VAR b = 0zDEADBEEF LET b ..= "xx" END - call CheckLegacyAndVim9Failure(lines, ['E734:', 'E1019:', 'E734:']) + call v9.CheckLegacyAndVim9Failure(lines, ['E734:', 'E1019:', 'E734:']) let lines =<< trim END VAR b = 0zDEADBEEF LET b += "xx" END - call CheckLegacyAndVim9Failure(lines, ['E734:', 'E1012:', 'E734:']) + call v9.CheckLegacyAndVim9Failure(lines, ['E734:', 'E1012:', 'E734:']) let lines =<< trim END VAR b = 0zDEADBEEF LET b[1 : 1] ..= 0z55 END - call CheckLegacyAndVim9Failure(lines, ['E734:', 'E1183:', 'E734:']) + call v9.CheckLegacyAndVim9Failure(lines, ['E734:', 'E1183:', 'E734:']) endfunc func Test_blob_get_range() @@ -133,7 +133,7 @@ func Test_blob_get_range() call assert_equal(0z, b[5 : 6]) call assert_equal(0z0011, b[-10 : 1]) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) " legacy script white space let b = 0z0011223344 @@ -158,19 +158,19 @@ func Test_blob_get() call assert_equal(0x44, b[4]) call assert_equal(0x44, b[-1]) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) let lines =<< trim END VAR b = 0z0011223344 echo b[5] END - call CheckLegacyAndVim9Failure(lines, 'E979:') + call v9.CheckLegacyAndVim9Failure(lines, 'E979:') let lines =<< trim END VAR b = 0z0011223344 echo b[-8] END - call CheckLegacyAndVim9Failure(lines, 'E979:') + call v9.CheckLegacyAndVim9Failure(lines, 'E979:') endfunc func Test_blob_to_string() @@ -184,7 +184,7 @@ func Test_blob_to_string() call assert_equal('0z', string(b)) call assert_equal('0z', string(test_null_blob())) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) endfunc func Test_blob_compare() @@ -211,54 +211,54 @@ func Test_blob_compare() call assert_false(b1 is b2) call assert_true(b1 isnot b2) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) let lines =<< trim END VAR b1 = 0z0011 echo b1 == 9 END - call CheckLegacyAndVim9Failure(lines, ['E977:', 'E1072', 'E1072']) + call v9.CheckLegacyAndVim9Failure(lines, ['E977:', 'E1072', 'E1072']) let lines =<< trim END VAR b1 = 0z0011 echo b1 != 9 END - call CheckLegacyAndVim9Failure(lines, ['E977:', 'E1072', 'E1072']) + call v9.CheckLegacyAndVim9Failure(lines, ['E977:', 'E1072', 'E1072']) let lines =<< trim END VAR b1 = 0z0011 VAR b2 = 0z1100 VAR x = b1 > b2 END - call CheckLegacyAndVim9Failure(lines, ['E978:', 'E1072:', 'E1072:']) + call v9.CheckLegacyAndVim9Failure(lines, ['E978:', 'E1072:', 'E1072:']) let lines =<< trim END VAR b1 = 0z0011 VAR b2 = 0z1100 VAR x = b1 < b2 END - call CheckLegacyAndVim9Failure(lines, ['E978:', 'E1072:', 'E1072:']) + call v9.CheckLegacyAndVim9Failure(lines, ['E978:', 'E1072:', 'E1072:']) let lines =<< trim END VAR b1 = 0z0011 VAR b2 = 0z1100 VAR x = b1 - b2 END - call CheckLegacyAndVim9Failure(lines, ['E974:', 'E1036:', 'E974:']) + call v9.CheckLegacyAndVim9Failure(lines, ['E974:', 'E1036:', 'E974:']) let lines =<< trim END VAR b1 = 0z0011 VAR b2 = 0z1100 VAR x = b1 / b2 END - call CheckLegacyAndVim9Failure(lines, ['E974:', 'E1036:', 'E974:']) + call v9.CheckLegacyAndVim9Failure(lines, ['E974:', 'E1036:', 'E974:']) let lines =<< trim END VAR b1 = 0z0011 VAR b2 = 0z1100 VAR x = b1 * b2 END - call CheckLegacyAndVim9Failure(lines, ['E974:', 'E1036:', 'E974:']) + call v9.CheckLegacyAndVim9Failure(lines, ['E974:', 'E1036:', 'E974:']) endfunc func Test_blob_index_assign() @@ -268,19 +268,19 @@ func Test_blob_index_assign() LET b[2] = 0x22 call assert_equal(0z001122, b) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) let lines =<< trim END VAR b = 0z00 LET b[2] = 0x33 END - call CheckLegacyAndVim9Failure(lines, 'E979:') + call v9.CheckLegacyAndVim9Failure(lines, 'E979:') let lines =<< trim END VAR b = 0z00 LET b[-2] = 0x33 END - call CheckLegacyAndVim9Failure(lines, 'E979:') + call v9.CheckLegacyAndVim9Failure(lines, 'E979:') endfunc func Test_blob_for_loop() @@ -313,7 +313,7 @@ func Test_blob_for_loop() endfor call assert_equal(5, i) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) endfunc func Test_blob_concatenate() @@ -325,19 +325,19 @@ func Test_blob_concatenate() LET b = 0zDEAD + 0zBEEF call assert_equal(0zDEADBEEF, b) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) let lines =<< trim END VAR b = 0z0011 LET b += "a" END - call CheckLegacyAndVim9Failure(lines, ['E734:', 'E1012:', 'E734:']) + call v9.CheckLegacyAndVim9Failure(lines, ['E734:', 'E1012:', 'E734:']) let lines =<< trim END VAR b = 0z0011 LET b += 88 END - call CheckLegacyAndVim9Failure(lines, ['E734:', 'E1012:', 'E734:']) + call v9.CheckLegacyAndVim9Failure(lines, ['E734:', 'E1012:', 'E734:']) endfunc func Test_blob_add() @@ -346,7 +346,7 @@ func Test_blob_add() call add(b, 0x22) call assert_equal(0z001122, b) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) " Only works in legacy script let b = 0z0011 @@ -358,18 +358,18 @@ func Test_blob_add() VAR b = 0z0011 call add(b, [9]) END - call CheckLegacyAndVim9Failure(lines, ['E745:', 'E1012:', 'E1210:']) + call v9.CheckLegacyAndVim9Failure(lines, ['E745:', 'E1012:', 'E1210:']) let lines =<< trim END VAR b = 0z0011 call add("", 0x01) END - call CheckLegacyAndVim9Failure(lines, ['E897:', 'E1013:', 'E1226:']) + call v9.CheckLegacyAndVim9Failure(lines, ['E897:', 'E1013:', 'E1226:']) let lines =<< trim END add(test_null_blob(), 0x22) END - call CheckDefExecAndScriptFailure(lines, 'E1131:') + call v9.CheckDefExecAndScriptFailure(lines, 'E1131:') let lines =<< trim END let b = 0zDEADBEEF @@ -377,7 +377,7 @@ func Test_blob_add() call add(b, 0) unlockvar b END - call CheckScriptFailure(lines, 'E741:') + call v9.CheckScriptFailure(lines, 'E741:') endfunc func Test_blob_empty() @@ -411,32 +411,32 @@ func Test_blob_func_remove() call assert_equal(0zADBE, remove(b, 1, 2)) call assert_equal(0zDEEF, b) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) " Test invalid cases let lines =<< trim END VAR b = 0zDEADBEEF call remove(b, 5) END - call CheckLegacyAndVim9Failure(lines, 'E979:') + call v9.CheckLegacyAndVim9Failure(lines, 'E979:') let lines =<< trim END VAR b = 0zDEADBEEF call remove(b, 1, 5) END - call CheckLegacyAndVim9Failure(lines, 'E979:') + call v9.CheckLegacyAndVim9Failure(lines, 'E979:') let lines =<< trim END VAR b = 0zDEADBEEF call remove(b, 3, 2) END - call CheckLegacyAndVim9Failure(lines, 'E979:') + call v9.CheckLegacyAndVim9Failure(lines, 'E979:') let lines =<< trim END VAR b = 0zDEADBEEF call remove(test_null_blob(), 1, 2) END - call CheckLegacyAndVim9Failure(lines, 'E979:') + call v9.CheckLegacyAndVim9Failure(lines, 'E979:') let lines =<< trim END let b = 0zDEADBEEF @@ -444,7 +444,7 @@ func Test_blob_func_remove() call remove(b, 0) unlockvar b END - call CheckScriptFailure(lines, 'E741:') + call v9.CheckScriptFailure(lines, 'E741:') " can only check at script level, not in a :def function let lines =<< trim END @@ -453,7 +453,7 @@ func Test_blob_func_remove() lockvar b remove(b, 0) END - call CheckScriptFailure(lines, 'E741:') + call v9.CheckScriptFailure(lines, 'E741:') call assert_fails('echo remove(0z1020, [])', 'E745:') call assert_fails('echo remove(0z1020, 0, [])', 'E745:') @@ -467,7 +467,7 @@ func Test_blob_read_write() call assert_equal(b, br) call delete('Xblob') END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) " This was crashing when calling readfile() with a directory. call assert_fails("call readfile('.', 'B')", 'E17: "." is a directory') @@ -485,7 +485,7 @@ func Test_blob_filter() call assert_equal(0z01030103, filter(0z010203010203, 'v:val != 0x02')) call assert_equal(0zADEF, filter(0zDEADBEEF, 'v:key % 2')) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) call assert_fails('echo filter(0z10, "a10")', 'E121:') endfunc @@ -496,12 +496,12 @@ func Test_blob_map() call assert_equal(0z00010203, map(0zDEADBEEF, 'v:key')) call assert_equal(0zDEAEC0F2, map(0zDEADBEEF, 'v:key + v:val')) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) let lines =<< trim END call map(0z00, '[9]') END - call CheckLegacyAndVim9Failure(lines, 'E978:') + call v9.CheckLegacyAndVim9Failure(lines, 'E978:') call assert_fails('echo map(0z10, "a10")', 'E121:') endfunc @@ -516,7 +516,7 @@ func Test_blob_index() call assert_equal(0, index(0z11110111, 0x11, -10)) call assert_equal(-1, index(test_null_blob(), 1)) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) endfunc func Test_blob_insert() @@ -529,7 +529,7 @@ func Test_blob_insert() call insert(b, 0x33, 2) call assert_equal(0zDEAD33BEEF, b) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) " only works in legacy script call assert_equal(0, insert(test_null_blob(), 0x33)) @@ -538,42 +538,42 @@ func Test_blob_insert() VAR b = 0zDEADBEEF call insert(b, -1) END - call CheckLegacyAndVim9Failure(lines, 'E475:') + call v9.CheckLegacyAndVim9Failure(lines, 'E475:') let lines =<< trim END VAR b = 0zDEADBEEF call insert(b, 257) END - call CheckLegacyAndVim9Failure(lines, 'E475:') + call v9.CheckLegacyAndVim9Failure(lines, 'E475:') let lines =<< trim END VAR b = 0zDEADBEEF call insert(b, 0, [9]) END - call CheckLegacyAndVim9Failure(lines, ['E745:', 'E1013:', 'E1210:']) + call v9.CheckLegacyAndVim9Failure(lines, ['E745:', 'E1013:', 'E1210:']) let lines =<< trim END VAR b = 0zDEADBEEF call insert(b, 0, -20) END - call CheckLegacyAndVim9Failure(lines, 'E475:') + call v9.CheckLegacyAndVim9Failure(lines, 'E475:') let lines =<< trim END VAR b = 0zDEADBEEF call insert(b, 0, 20) END - call CheckLegacyAndVim9Failure(lines, 'E475:') + call v9.CheckLegacyAndVim9Failure(lines, 'E475:') let lines =<< trim END VAR b = 0zDEADBEEF call insert(b, []) END - call CheckLegacyAndVim9Failure(lines, ['E745:', 'E1013:', 'E1210:']) + call v9.CheckLegacyAndVim9Failure(lines, ['E745:', 'E1013:', 'E1210:']) let lines =<< trim END insert(test_null_blob(), 0x33) END - call CheckDefExecAndScriptFailure(lines, 'E1131:') + call v9.CheckDefExecAndScriptFailure(lines, 'E1131:') let lines =<< trim END let b = 0zDEADBEEF @@ -581,7 +581,7 @@ func Test_blob_insert() call insert(b, 3) unlockvar b END - call CheckScriptFailure(lines, 'E741:') + call v9.CheckScriptFailure(lines, 'E741:') let lines =<< trim END vim9script @@ -589,7 +589,7 @@ func Test_blob_insert() lockvar b insert(b, 3) END - call CheckScriptFailure(lines, 'E741:') + call v9.CheckScriptFailure(lines, 'E741:') endfunc func Test_blob_reverse() @@ -600,7 +600,7 @@ func Test_blob_reverse() call assert_equal(0zDE, reverse(0zDE)) call assert_equal(0z, reverse(test_null_blob())) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) endfunc func Test_blob_json_encode() @@ -608,7 +608,7 @@ func Test_blob_json_encode() call assert_equal('[222,173,190,239]', json_encode(0zDEADBEEF)) call assert_equal('[]', json_encode(0z)) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) endfunc func Test_blob_lock() @@ -618,7 +618,7 @@ func Test_blob_lock() unlockvar b let b = 0z44 END - call CheckScriptSuccess(lines) + call v9.CheckScriptSuccess(lines) let lines =<< trim END vim9script @@ -627,14 +627,14 @@ func Test_blob_lock() unlockvar b b = 0z44 END - call CheckScriptSuccess(lines) + call v9.CheckScriptSuccess(lines) let lines =<< trim END let b = 0z112233 lockvar b let b = 0z44 END - call CheckScriptFailure(lines, 'E741:') + call v9.CheckScriptFailure(lines, 'E741:') let lines =<< trim END vim9script @@ -642,14 +642,14 @@ func Test_blob_lock() lockvar b b = 0z44 END - call CheckScriptFailure(lines, 'E741:') + call v9.CheckScriptFailure(lines, 'E741:') endfunc func Test_blob_sort() if has('float') - call CheckLegacyAndVim9Failure(['call sort([1.0, 0z11], "f")'], 'E975:') + call v9.CheckLegacyAndVim9Failure(['call sort([1.0, 0z11], "f")'], 'E975:') endif - call CheckLegacyAndVim9Failure(['call sort([11, 0z11], "N")'], 'E974:') + call v9.CheckLegacyAndVim9Failure(['call sort([11, 0z11], "N")'], 'E974:') endfunc " Tests for the blob2list() function diff --git a/src/testdir/test_debugger.vim b/src/testdir/test_debugger.vim index 0c4bc870d5..c05f4e1e47 100644 --- a/src/testdir/test_debugger.vim +++ b/src/testdir/test_debugger.vim @@ -360,16 +360,16 @@ def Test_Debugger_breakadd_expr() writefile(lines, 'Xtest.vim') # Start Vim in a terminal - var buf = RunVimInTerminal('-S Xtest.vim', {wait_for_ruler: 0}) - call TermWait(buf) + var buf = g:RunVimInTerminal('-S Xtest.vim', {wait_for_ruler: 0}) + call g:TermWait(buf) # Despite the failure the functions are defined - RunDbgCmd(buf, ':function g:EarlyFunc', + g:RunDbgCmd(buf, ':function g:EarlyFunc', ['function EarlyFunc()', 'endfunction'], {match: 'pattern'}) - RunDbgCmd(buf, ':function g:LaterFunc', + g:RunDbgCmd(buf, ':function g:LaterFunc', ['function LaterFunc()', 'endfunction'], {match: 'pattern'}) - call StopVimInTerminal(buf) + call g:StopVimInTerminal(buf) call delete('Xtest.vim') enddef @@ -386,13 +386,13 @@ def Test_Debugger_break_at_return() writefile(lines, 'Xtest.vim') # Start Vim in a terminal - var buf = RunVimInTerminal('-S Xtest.vim', {wait_for_ruler: 0}) - call TermWait(buf) + var buf = g:RunVimInTerminal('-S Xtest.vim', {wait_for_ruler: 0}) + call g:TermWait(buf) - RunDbgCmd(buf, ':call GetNum()', + g:RunDbgCmd(buf, ':call GetNum()', ['line 1: return 1 + 2 + 3'], {match: 'pattern'}) - call StopVimInTerminal(buf) + call g:StopVimInTerminal(buf) call delete('Xtest.vim') enddef diff --git a/src/testdir/test_execute_func.vim b/src/testdir/test_execute_func.vim index 8cd5e7d270..3a8580e98d 100644 --- a/src/testdir/test_execute_func.vim +++ b/src/testdir/test_execute_func.vim @@ -2,7 +2,7 @@ source view_util.vim source check.vim -source vim9.vim +import './vim9.vim' as v9 source term_util.vim func NestedEval() @@ -41,7 +41,7 @@ func Test_execute_string() if has('float') call assert_fails('call execute(3.4)', 'E492:') call assert_equal("\nx", execute("echo \"x\"", 3.4)) - call CheckDefExecAndScriptFailure(['execute("echo \"x\"", 3.4)'], ['E1013: Argument 2: type mismatch, expected string but got float', 'E1174:']) + call v9.CheckDefExecAndScriptFailure(['execute("echo \"x\"", 3.4)'], ['E1013: Argument 2: type mismatch, expected string but got float', 'E1174:']) endif endfunc diff --git a/src/testdir/test_expr.vim b/src/testdir/test_expr.vim index 8a65a8990a..4d085de1d8 100644 --- a/src/testdir/test_expr.vim +++ b/src/testdir/test_expr.vim @@ -1,7 +1,7 @@ " Tests for expressions. source check.vim -source vim9.vim +import './vim9.vim' as v9 func Test_equal() let base = {} @@ -51,12 +51,12 @@ func Test_op_trinary() call assert_fails('echo [1] ? "yes" : "no"', 'E745:') call assert_fails('echo {} ? "yes" : "no"', 'E728:') END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) call assert_equal('no', 'x' ? 'yes' : 'no') - call CheckDefAndScriptFailure(["'x' ? 'yes' : 'no'"], 'E1135:') + call v9.CheckDefAndScriptFailure(["'x' ? 'yes' : 'no'"], 'E1135:') call assert_equal('yes', '1x' ? 'yes' : 'no') - call CheckDefAndScriptFailure(["'1x' ? 'yes' : 'no'"], 'E1135:') + call v9.CheckDefAndScriptFailure(["'1x' ? 'yes' : 'no'"], 'E1135:') endfunc func Test_op_falsy() @@ -81,7 +81,7 @@ func Test_op_falsy() call assert_equal(456, 0.0 ?? 456) endif END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) endfunc func Test_dict() @@ -101,9 +101,9 @@ func Test_dict() LET d[ 'b' ] = 'bbb' call assert_equal('bbb', d[ 'b' ]) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) - call CheckLegacyAndVim9Failure(["VAR i = has_key([], 'a')"], ['E715:', 'E1013:', 'E1206:']) + call v9.CheckLegacyAndVim9Failure(["VAR i = has_key([], 'a')"], ['E715:', 'E1013:', 'E1206:']) endfunc func Test_strgetchar() @@ -116,10 +116,10 @@ func Test_strgetchar() call assert_equal(-1, strgetchar('axb', 3)) call assert_equal(-1, strgetchar('', 0)) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) - call CheckLegacyAndVim9Failure(["VAR c = strgetchar([], 1)"], ['E730:', 'E1013:', 'E1174:']) - call CheckLegacyAndVim9Failure(["VAR c = strgetchar('axb', [])"], ['E745:', 'E1013:', 'E1210:']) + call v9.CheckLegacyAndVim9Failure(["VAR c = strgetchar([], 1)"], ['E730:', 'E1013:', 'E1174:']) + call v9.CheckLegacyAndVim9Failure(["VAR c = strgetchar('axb', [])"], ['E745:', 'E1013:', 'E1210:']) endfunc func Test_strcharpart() @@ -138,7 +138,7 @@ func Test_strcharpart() call assert_equal('edit', "editor"[-10 : 3]) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) endfunc func Test_getreg_empty_list() @@ -150,9 +150,9 @@ func Test_getreg_empty_list() call add(x, 'foo') call assert_equal(['foo'], y) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) - call CheckLegacyAndVim9Failure(['call getreg([])'], ['E730:', 'E1013:', 'E1174:']) + call v9.CheckLegacyAndVim9Failure(['call getreg([])'], ['E730:', 'E1013:', 'E1174:']) endfunc func Test_loop_over_null_list() @@ -162,19 +162,19 @@ func Test_loop_over_null_list() call assert_report('should not get here') endfor END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) endfunc func Test_setreg_null_list() let lines =<< trim END call setreg('x', test_null_list()) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) endfunc func Test_special_char() " The failure is only visible using valgrind. - call CheckLegacyAndVim9Failure(['echo "\<C-">'], ['E15:', 'E1004:', 'E1004:']) + call v9.CheckLegacyAndVim9Failure(['echo "\<C-">'], ['E15:', 'E1004:', 'E1004:']) endfunc func Test_method_with_prefix() @@ -182,13 +182,13 @@ func Test_method_with_prefix() call assert_equal(TRUE, !range(5)->empty()) call assert_equal(FALSE, !-3) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) call assert_equal([0, 1, 2], --3->range()) - call CheckDefAndScriptFailure(['eval --3->range()'], 'E15') + call v9.CheckDefAndScriptFailure(['eval --3->range()'], 'E15') call assert_equal(1, !+-+0) - call CheckDefAndScriptFailure(['eval !+-+0'], 'E15') + call v9.CheckDefAndScriptFailure(['eval !+-+0'], 'E15') endfunc func Test_option_value() @@ -214,7 +214,7 @@ func Test_option_value() call assert_equal("abcdefgi", &cpo) set cpo&vim END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) endfunc func Test_printf_misc() @@ -407,9 +407,9 @@ func Test_printf_misc() call assert_equal('1%', printf('%d%%', 1)) call assert_notequal('', printf('%p', "abc")) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) - call CheckLegacyAndVim9Failure(["call printf('123', 3)"], "E767:") + call v9.CheckLegacyAndVim9Failure(["call printf('123', 3)"], "E767:") endfunc func Test_printf_float() @@ -519,21 +519,21 @@ func Test_printf_float() call assert_equal('nan', printf('%S', 0.0 / 0.0)) call assert_equal('nan', printf('%S', -0.0 / 0.0)) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) - call CheckLegacyAndVim9Failure(['echo printf("%f", "a")'], 'E807:') + call v9.CheckLegacyAndVim9Failure(['echo printf("%f", "a")'], 'E807:') endif endfunc func Test_printf_errors() - call CheckLegacyAndVim9Failure(['echo printf("%d", {})'], 'E728:') - call CheckLegacyAndVim9Failure(['echo printf("%d", [])'], 'E745:') - call CheckLegacyAndVim9Failure(['echo printf("%d", 1, 2)'], 'E767:') - call CheckLegacyAndVim9Failure(['echo printf("%*d", 1)'], 'E766:') - call CheckLegacyAndVim9Failure(['echo printf("%s")'], 'E766:') + call v9.CheckLegacyAndVim9Failure(['echo printf("%d", {})'], 'E728:') + call v9.CheckLegacyAndVim9Failure(['echo printf("%d", [])'], 'E745:') + call v9.CheckLegacyAndVim9Failure(['echo printf("%d", 1, 2)'], 'E767:') + call v9.CheckLegacyAndVim9Failure(['echo printf("%*d", 1)'], 'E766:') + call v9.CheckLegacyAndVim9Failure(['echo printf("%s")'], 'E766:') if has('float') - call CheckLegacyAndVim9Failure(['echo printf("%d", 1.2)'], 'E805:') - call CheckLegacyAndVim9Failure(['echo printf("%f")'], 'E766:') + call v9.CheckLegacyAndVim9Failure(['echo printf("%d", 1.2)'], 'E805:') + call v9.CheckLegacyAndVim9Failure(['echo printf("%f")'], 'E766:') endif endfunc @@ -541,7 +541,7 @@ func Test_printf_64bit() let lines =<< trim END call assert_equal("123456789012345", printf('%d', 123456789012345)) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) endfunc func Test_printf_spec_s() @@ -571,7 +571,7 @@ func Test_printf_spec_s() #" partial call assert_equal(string(function('printf', ['%s'])), printf('%s', function('printf', ['%s']))) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) endfunc func Test_printf_spec_b() @@ -587,14 +587,14 @@ func Test_printf_spec_b() call assert_equal("11100000100100010000110000011011101111101111001", printf('%b', 123456789012345)) call assert_equal("111111111111111111111111111111111111111111111111111111111 |