diff options
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_partial.vim | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/testdir/test_partial.vim b/src/testdir/test_partial.vim index 5f4a48faf..8b11200d2 100644 --- a/src/testdir/test_partial.vim +++ b/src/testdir/test_partial.vim @@ -257,3 +257,25 @@ func Test_ref_job_partial_dict() call job_setoptions(g:ref_job, {'exit_cb': function('string', [], d)}) endif endfunc + +func Test_auto_partial_rebind() + let dict1 = {'name': 'dict1'} + func! dict1.f1() + return self.name + endfunc + let dict1.f2 = function(dict1.f1, dict1) + + call assert_equal('dict1', dict1.f1()) + call assert_equal('dict1', dict1['f1']()) + call assert_equal('dict1', dict1.f2()) + call assert_equal('dict1', dict1['f2']()) + + let dict2 = {'name': 'dict2'} + let dict2.f1 = dict1.f1 + let dict2.f2 = dict1.f2 + + call assert_equal('dict2', dict2.f1()) + call assert_equal('dict2', dict2['f1']()) + call assert_equal('dict1', dict2.f2()) + call assert_equal('dict1', dict2['f2']()) +endfunc |