patch 8.2.0772: Vim9: some variable initializations not tested
Problem: Vim9: some variable initializations not tested.
Solution: Add a few more tests
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index 4284aad..f539184 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -1736,6 +1736,8 @@
return 'this'
endfunc
let val: string = GetValue()
+ " env var is always a string
+ let env = $TERM
END
writefile(lines, 'Xfinished')
source Xfinished
@@ -1752,13 +1754,40 @@
func GetValue()
return 'this'
endfunc
- let val = GetValue()
+ let val = GetValue()
END
CheckScriptFailure(lines, 'E1091:')
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:')
diff --git a/src/version.c b/src/version.c
index c369a71..fa8ba91 100644
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 772,
+/**/
771,
/**/
770,