]> granicus.if.org Git - vim/commitdiff
patch 8.2.0772: Vim9: some variable initializations not tested v8.2.0772
authorBram Moolenaar <Bram@vim.org>
Sat, 16 May 2020 20:33:33 +0000 (22:33 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 16 May 2020 20:33:33 +0000 (22:33 +0200)
Problem:    Vim9: some variable initializations not tested.
Solution:   Add a few more tests

src/testdir/test_vim9_script.vim
src/version.c

index 4284aada246a899e2a9c70bad23924a9993bf9d2..f5391847c230936a21e218dedcead106f1d4f53f 100644 (file)
@@ -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
@@ -1752,13 +1754,40 @@ def Test_let_missing_type()
     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:')
 
index c369a716060b28164f6a4238b5b4ce7b03660205..fa8ba91ce47de6488bf5a72fae3bf2e32ecf4e63 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    772,
 /**/
     771,
 /**/