changeset 22582:a3df1fb28d44 v8.2.1839

patch 8.2.1839: Vim9: memory leaks reported in assign test Commit: https://github.com/vim/vim/commit/fc8aa6d02d85b0df703e0a790137891c91503c9e Author: Bram Moolenaar <Bram@vim.org> Date: Mon Oct 12 20:31:26 2020 +0200 patch 8.2.1839: Vim9: memory leaks reported in assign test Problem: Vim9: memory leaks reported in assign test. Solution: Move the failing job_start() call to separate test files, it causes false leak reports.
author Bram Moolenaar <Bram@vim.org>
date Mon, 12 Oct 2020 20:45:05 +0200
parents ede5047486b7
children 973eeeb5c6a6
files src/testdir/Make_all.mak src/testdir/test_vim9_assign.vim src/testdir/test_vim9_fails.vim src/version.c
diffstat 4 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -34,6 +34,7 @@ TEST_VIM9 = \
 	test_vim9_cmd \
 	test_vim9_disassemble \
 	test_vim9_expr \
+	test_vim9_fails \
 	test_vim9_func \
 	test_vim9_script
 
@@ -42,6 +43,7 @@ TEST_VIM9_RES = \
 	test_vim9_cmd.res \
 	test_vim9_disassemble.res \
 	test_vim9_expr.res \
+	test_vim9_fails.res \
 	test_vim9_func.res \
 	test_vim9_script.res
 
--- a/src/testdir/test_vim9_assign.vim
+++ b/src/testdir/test_vim9_assign.vim
@@ -75,7 +75,7 @@ def Test_assignment()
   if has('channel')
     var chan1: channel
     var job1: job
-    var job2: job = job_start('willfail')
+    # calling job_start() is in test_vim9_fails.vim, it causes leak reports
   endif
   if has('float')
     var float1: float = 3.4
@@ -216,12 +216,9 @@ def Test_assignment()
   CheckDefFailure(['v:errmsg += "more"'], 'E1051:')
   CheckDefFailure(['v:errmsg += 123'], 'E1012:')
 
-  # this should not leak
-  if 0
-    var text =<< trim END
-      some text
-    END
-  endif
+  var text =<< trim END
+    some text
+  END
 enddef
 
 def Test_extend_list()
new file mode 100644
--- /dev/null
+++ b/src/testdir/test_vim9_fails.vim
@@ -0,0 +1,10 @@
+" Test for Vim9 script with failures, causing memory leaks to be reported.
+" The leaks happen after a fork() and can be ignored.
+
+def Test_assignment()
+  if has('channel')
+    var chan1: channel
+    var job1: job
+    var job2: job = job_start('willfail')
+  endif
+enddef
--- 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 */
 /**/
+    1839,
+/**/
     1838,
 /**/
     1837,