summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-03-14 10:50:23 +0000
committerBram Moolenaar <Bram@vim.org>2022-03-14 10:50:23 +0000
commit129e33e44bdbd91d6d7cd49d96268cbed4a05f07 (patch)
treef9901eff25bb14dbbc62c51664dfb8e290d6f0a5
parent5c68617d395f9d7b824f68475b24ce3e38d653a3 (diff)
patch 8.2.4564: running test leaves file behindv8.2.4564
Problem: Running test leaves file behind. (Dominique Pellé) Solution: Run the profiling in a separate Vim instance. (closes #9952)
-rw-r--r--src/testdir/test_vim9_script.vim86
-rw-r--r--src/version.c2
2 files changed, 55 insertions, 33 deletions
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index 594b1cd2c4..dfa2a2d288 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -3882,27 +3882,6 @@ def Run_Test_debug_running_out_of_lines()
delete('XdebugFunc')
enddef
-def s:ProfiledWithLambda()
- var n = 3
- echo [[1, 2], [3, 4]]->filter((_, l) => l[0] == n)
-enddef
-
-def s:ProfiledNested()
- var x = 0
- def Nested(): any
- return x
- enddef
- Nested()
-enddef
-
-def ProfiledNestedProfiled()
- var x = 0
- def Nested(): any
- return x
- enddef
- Nested()
-enddef
-
def Test_ambigous_command_error()
var lines =<< trim END
vim9script
@@ -3935,23 +3914,64 @@ enddef
" Execute this near the end, profiling doesn't stop until Vim exits.
" This only tests that it works, not the profiling output.
-def Test_xx_profile_with_lambda()
+def Test_profile_with_lambda()
CheckFeature profile
- profile start Xprofile.log
- profile func ProfiledWithLambda
- ProfiledWithLambda()
+ var lines =<< trim END
+ vim9script
+
+ def ProfiledWithLambda()
+ var n = 3
+ echo [[1, 2], [3, 4]]->filter((_, l) => l[0] == n)
+ enddef
- profile func ProfiledNested
- ProfiledNested()
+ def ProfiledNested()
+ var x = 0
+ def Nested(): any
+ return x
+ enddef
+ Nested()
+ enddef
- # Also profile the nested function. Use a different function, although the
- # contents is the same, to make sure it was not already compiled.
- profile func *
- g:ProfiledNestedProfiled()
+ def g:ProfiledNestedProfiled()
+ var x = 0
+ def Nested(): any
+ return x
+ enddef
+ Nested()
+ enddef
+
+ def Profile()
+ profile start Xprofile.log
+ profile func ProfiledWithLambda
+ ProfiledWithLambda()
+
+ profile func ProfiledNested
+ ProfiledNested()
- profdel func *
- profile pause
+ # Also profile the nested function. Use a different function, although the
+ # contents is the same, to make sure it was not already compiled.
+ profile func *
+ g:ProfiledNestedProfiled()
+
+ profdel func *
+ profile pause
+ enddef
+ Profile()
+ writefile(['done'], 'Xdidprofile')
+ END
+ writefile(lines, 'Xprofile.vim')
+ call system(g:GetVimCommand()
+ .. ' --clean'
+ .. ' -c "so Xprofile.vim"'
+ .. ' -c "qall!"')
+ call assert_equal(0, v:shell_error)
+
+ assert_equal(['done'], readfile('Xdidprofile'))
+ assert_true(filereadable('Xprofile.log'))
+ delete('Xdidprofile')
+ delete('Xprofile.log')
+ delete('Xprofile.vim')
enddef
" Keep this last, it messes up highlighting.
diff --git a/src/version.c b/src/version.c
index e5ff441653..bf3116ec9f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 4564,
+/**/
4563,
/**/
4562,