]> granicus.if.org Git - vim/commitdiff
patch 8.2.1839: Vim9: memory leaks reported in assign test v8.2.1839
authorBram Moolenaar <Bram@vim.org>
Mon, 12 Oct 2020 18:31:26 +0000 (20:31 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 12 Oct 2020 18:31:26 +0000 (20:31 +0200)
Problem:    Vim9: memory leaks reported in assign test.
Solution:   Move the failing job_start() call to separate test files, it
            causes false leak reports.

src/testdir/Make_all.mak
src/testdir/test_vim9_assign.vim
src/testdir/test_vim9_fails.vim [new file with mode: 0644]
src/version.c

index eecc2e7fd36a37c3c56d560a6f6dd9e507495661..c8ad66a8ba5bb0bbfcd4a772bf0f2efad3522bb6 100644 (file)
@@ -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
 
index 1b56df54b5c6bbffd98f0ab240483c66d2aada1c..cf06b5cd8919913d34d25b66db96bd6da6203357 100644 (file)
@@ -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()
diff --git a/src/testdir/test_vim9_fails.vim b/src/testdir/test_vim9_fails.vim
new file mode 100644 (file)
index 0000000..e09eb65
--- /dev/null
@@ -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
index 8f85e6b0e8eb1dd8ca31bdb93cbfb1c7e378958d..f972cbd641bb4dcd0f0df71c562432a96b6fcd82 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1839,
 /**/
     1838,
 /**/