0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.2718: Vim9: no explicit test for using a global function without g:

Problem:    Vim9: no explicit test for using a global function without the g:
            prefix.
Solution:   Add a test case.
This commit is contained in:
Bram Moolenaar
2021-04-05 15:38:51 +02:00
parent ce5b06a6a9
commit 0865b15bc6
2 changed files with 26 additions and 0 deletions

View File

@@ -621,6 +621,30 @@ def Test_local_function_shadows_global()
END END
CheckScriptFailure(lines, 'E705:') CheckScriptFailure(lines, 'E705:')
delfunc g:Func delfunc g:Func
# global function is found without g: prefix
lines =<< trim END
vim9script
def g:Func(): string
return 'global'
enddef
def AnotherFunc(): string
return Func()
enddef
assert_equal('global', AnotherFunc())
delfunc g:Func
END
CheckScriptSuccess(lines)
lines =<< trim END
vim9script
def g:Func(): string
return 'global'
enddef
assert_equal('global', Func())
delfunc g:Func
END
CheckScriptSuccess(lines)
enddef enddef
func TakesOneArg(arg) func TakesOneArg(arg)

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2718,
/**/ /**/
2717, 2717,
/**/ /**/