0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.2.0754: Vim9: No test for forward declaration

Problem:    Vim9: No test for forward declaration.
Solution:   Add a test.
This commit is contained in:
Bram Moolenaar 2020-05-14 23:20:55 +02:00
parent 32e351179e
commit a5d0077efb
2 changed files with 25 additions and 0 deletions

View File

@ -1732,6 +1732,7 @@ def Test_let_func_call()
END
writefile(lines, 'Xfinished')
source Xfinished
" GetValue() is not called during discovery phase
assert_equal(1, g:count)
unlet g:count
@ -1752,6 +1753,28 @@ def Test_let_missing_type()
delete('Xfinished')
enddef
def Test_forward_declaration()
let lines =<< trim END
vim9script
g:initVal = GetValue()
def GetValue(): string
return theVal
enddef
let theVal = 'something'
theVal = 'else'
g:laterVal = GetValue()
END
writefile(lines, 'Xforward')
source Xforward
assert_equal('something', g:initVal)
assert_equal('else', g:laterVal)
unlet g:initVal
unlet g:laterVal
delete('Xforward')
enddef
" Keep this last, it messes up highlighting.
def Test_substitute_cmd()
new

View File

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