diff src/testdir/test_partial.vim @ 8698:13b0ed12a78a v7.4.1638

commit https://github.com/vim/vim/commit/e4eb6ff089e79e659acf33c17dd0fda7177de526 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Mar 22 21:00:09 2016 +0100 patch 7.4.1638 Problem: When binding a function to a dict the reference count is wrong. Solution: Decrement dict reference count, only reference the function when actually making a copy. (Ken Takata)
author Christian Brabandt <cb@256bit.org>
date Tue, 22 Mar 2016 21:15:11 +0100
parents ff41ece2e4b8
children af3cb5c068fd
line wrap: on
line diff
--- a/src/testdir/test_partial.vim
+++ b/src/testdir/test_partial.vim
@@ -170,3 +170,13 @@ func Test_partial_string()
   let F = function('MyFunc', ['foo'], d)
   call assert_equal("function('MyFunc', ['foo'], {'one': 1})", string(F))
 endfunc
+
+func Test_func_unref()
+  let obj = {}
+  function! obj.func() abort
+  endfunction
+  let funcnumber = matchstr(string(obj.func), '^function(''\zs.\{-}\ze''')
+  call assert_true(exists('*{' . funcnumber . '}'))
+  unlet obj
+  call assert_false(exists('*{' . funcnumber . '}'))
+endfunc