Mercurial > vim
diff src/testdir/test_iminsert.vim @ 27457:4c16acb2525f v8.2.4257
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Commit: https://github.com/vim/vim/commit/62aec93bfdb9e1b40d03a6d2e8e9511f8b1bdb2d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 29 21:45:34 2022 +0000
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 29 Jan 2022 23:00:05 +0100 |
parents | 33d680d372aa |
children | 54247d52bee9 |
line wrap: on
line diff
--- a/src/testdir/test_iminsert.vim +++ b/src/testdir/test_iminsert.vim @@ -2,7 +2,7 @@ source view_util.vim source check.vim -source vim9.vim +import './vim9.vim' as v9 let s:imactivatefunc_called = 0 let s:imstatusfunc_called = 0 @@ -165,28 +165,28 @@ func Test_imactivatefunc_imstatusfunc_ca normal! i #" Test for using a lambda function - VAR optval = "LSTART a LMIDDLE IMactivatefunc1(a) LEND" + VAR optval = "LSTART a LMIDDLE g:IMactivatefunc1(a) LEND" LET optval = substitute(optval, ' ', '\\ ', 'g') exe "set imactivatefunc=" .. optval - LET optval = "LSTART LMIDDLE IMstatusfunc1() LEND" + LET optval = "LSTART LMIDDLE g:IMstatusfunc1() LEND" LET optval = substitute(optval, ' ', '\\ ', 'g') exe "set imstatusfunc=" .. optval normal! i #" Set 'imactivatefunc' and 'imstatusfunc' to a lambda expression - LET &imactivatefunc = LSTART a LMIDDLE IMactivatefunc1(a) LEND - LET &imstatusfunc = LSTART LMIDDLE IMstatusfunc1() LEND + LET &imactivatefunc = LSTART a LMIDDLE g:IMactivatefunc1(a) LEND + LET &imstatusfunc = LSTART LMIDDLE g:IMstatusfunc1() LEND normal! i #" Set 'imactivatefunc' and 'imstatusfunc' to a string(lambda expression) - LET &imactivatefunc = 'LSTART a LMIDDLE IMactivatefunc1(a) LEND' - LET &imstatusfunc = 'LSTART LMIDDLE IMstatusfunc1() LEND' + LET &imactivatefunc = 'LSTART a LMIDDLE g:IMactivatefunc1(a) LEND' + LET &imstatusfunc = 'LSTART LMIDDLE g:IMstatusfunc1() LEND' normal! i #" Set 'imactivatefunc' 'imstatusfunc' to a variable with a lambda #" expression - VAR Lambda1 = LSTART a LMIDDLE IMactivatefunc1(a) LEND - VAR Lambda2 = LSTART LMIDDLE IMstatusfunc1() LEND + VAR Lambda1 = LSTART a LMIDDLE g:IMactivatefunc1(a) LEND + VAR Lambda2 = LSTART LMIDDLE g:IMstatusfunc1() LEND LET &imactivatefunc = Lambda1 LET &imstatusfunc = Lambda2 normal! i @@ -223,7 +223,7 @@ func Test_imactivatefunc_imstatusfunc_ca call assert_equal(14, g:IMactivatefunc_called) call assert_equal(28, g:IMstatusfunc_called) END - call CheckLegacyAndVim9Success(lines) + call v9.CheckLegacyAndVim9Success(lines) " Using Vim9 lambda expression in legacy context should fail set imactivatefunc=(a)\ =>\ IMactivatefunc1(a) @@ -285,7 +285,7 @@ func Test_imactivatefunc_imstatusfunc_ca set imactivatefunc= set imstatusfunc= END - call CheckScriptSuccess(lines) + call v9.CheckScriptSuccess(lines) " cleanup set iminsert=0