mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -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:
@@ -621,6 +621,30 @@ def Test_local_function_shadows_global()
|
||||
END
|
||||
CheckScriptFailure(lines, 'E705:')
|
||||
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
|
||||
|
||||
func TakesOneArg(arg)
|
||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
2718,
|
||||
/**/
|
||||
2717,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user