1
0
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:
Bram Moolenaar
2020-05-16 22:33:33 +02:00
parent 6f5b6dfb16
commit df671b4629
2 changed files with 33 additions and 2 deletions

View File

@@ -1736,6 +1736,8 @@ def Test_let_func_call()
return 'this' return 'this'
endfunc endfunc
let val: string = GetValue() let val: string = GetValue()
" env var is always a string
let env = $TERM
END END
writefile(lines, 'Xfinished') writefile(lines, 'Xfinished')
source Xfinished source Xfinished
@@ -1758,7 +1760,34 @@ def Test_let_missing_type()
lines =<< trim END lines =<< trim END
vim9script 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 END
CheckScriptFailure(lines, 'E1091:') CheckScriptFailure(lines, 'E1091:')

View File

@@ -746,6 +746,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 */
/**/
772,
/**/ /**/
771, 771,
/**/ /**/