]> granicus.if.org Git - vim/commitdiff
patch 8.2.0754: Vim9: No test for forward declaration v8.2.0754
authorBram Moolenaar <Bram@vim.org>
Thu, 14 May 2020 21:20:55 +0000 (23:20 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 14 May 2020 21:20:55 +0000 (23:20 +0200)
Problem:    Vim9: No test for forward declaration.
Solution:   Add a test.

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

index c528b8009b0aae9a3794239752e3348e96a5bd9a..6b6228e5ed3e5b5b19a23f239cdb6eec8b4c385e 100644 (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
index ad56b7af19d809ece01d074c837b9dd343e828e0..8ff5161e72fc52efcb18d7711d9ccd640c51af11 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    754,
 /**/
     753,
 /**/