diff src/testdir/test_vim9_script.vim @ 25222:fbb530e081ca v8.2.3147

patch 8.2.3147: Vim9: profiling does not work with a nested function Commit: https://github.com/vim/vim/commit/648594eaf703fe9a862cb12a35702a10aff6e5a9 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 11 17:55:01 2021 +0200 patch 8.2.3147: Vim9: profiling does not work with a nested function Problem: Vim9: profiling does not work with a nested function. Solution: Also compile a nested function without profiling. (closes https://github.com/vim/vim/issues/8543) Handle that compiling may cause the table of compiled functions to change.
author Bram Moolenaar <Bram@vim.org>
date Sun, 11 Jul 2021 18:00:04 +0200
parents 89b39ce243e2
children 658dfd6be868
line wrap: on
line diff
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -4177,19 +4177,29 @@ def Test_xxx_echoerr_line_number()
   CheckDefExecAndScriptFailure(lines, 'some error continued', 1)
 enddef
 
-def ProfiledFunc()
+def ProfiledWithLambda()
   var n = 3
   echo [[1, 2], [3, 4]]->filter((_, l) => l[0] == n)
 enddef
 
+def ProfiledNested()
+  var x = 0
+  def Nested(): any
+      return x
+  enddef
+  Nested()
+enddef
+
 " Execute this near the end, profiling doesn't stop until Vim exists.
 " This only tests that it works, not the profiling output.
 def Test_xx_profile_with_lambda()
   CheckFeature profile
 
   profile start Xprofile.log
-  profile func ProfiledFunc
-  ProfiledFunc()
+  profile func ProfiledWithLambda
+  ProfiledWithLambda()
+  profile func ProfiledNested
+  ProfiledNested()
 enddef
 
 " Keep this last, it messes up highlighting.