forked from aniani/vim
patch 8.2.0772: Vim9: some variable initializations not tested
Problem: Vim9: some variable initializations not tested. Solution: Add a few more tests
This commit is contained in:
@@ -1736,6 +1736,8 @@ def Test_let_func_call()
|
||||
return 'this'
|
||||
endfunc
|
||||
let val: string = GetValue()
|
||||
" env var is always a string
|
||||
let env = $TERM
|
||||
END
|
||||
writefile(lines, 'Xfinished')
|
||||
source Xfinished
|
||||
@@ -1758,7 +1760,34 @@ def Test_let_missing_type()
|
||||
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
let var = g:unkown
|
||||
func GetValue()
|
||||
return 'this'
|
||||
endfunc
|
||||
let val = [GetValue()]
|
||||
END
|
||||
CheckScriptFailure(lines, 'E1091:')
|
||||
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
func GetValue()
|
||||
return 'this'
|
||||
endfunc
|
||||
let val = {GetValue(): 123}
|
||||
END
|
||||
CheckScriptFailure(lines, 'E1091:')
|
||||
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
func GetValue()
|
||||
return 'this'
|
||||
endfunc
|
||||
let val = {'a': GetValue()}
|
||||
END
|
||||
CheckScriptFailure(lines, 'E1091:')
|
||||
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
let var = g:unknown
|
||||
END
|
||||
CheckScriptFailure(lines, 'E1091:')
|
||||
|
||||
|
@@ -746,6 +746,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
772,
|
||||
/**/
|
||||
771,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user