diff options
| author | Michael Ennen <mike.ennen@gmail.com> | 2016-10-27 13:48:32 -0700 |
|---|---|---|
| committer | James McCoy <jamessan@jamessan.com> | 2016-12-12 10:17:35 -0500 |
| commit | 531249a4acdef36ed44e8bbf1355f2a80a5792a5 (patch) | |
| tree | 2e526057b7ad1115a72140c0571351a1cacd9eef /src/nvim/testdir | |
| parent | cf2701b269a0fd1490da4296774b9fe426100640 (diff) | |
| download | rneovim-531249a4acdef36ed44e8bbf1355f2a80a5792a5.tar.gz rneovim-531249a4acdef36ed44e8bbf1355f2a80a5792a5.tar.bz2 rneovim-531249a4acdef36ed44e8bbf1355f2a80a5792a5.zip | |
vim-patch:7.4.1589
Problem: Combining dict and args with partial doesn't always work.
Solution: Use the arguments from the partial.
https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_partial.vim | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_partial.vim b/src/nvim/testdir/test_partial.vim index ae4f74cf5b..2b6b56c358 100644 --- a/src/nvim/testdir/test_partial.vim +++ b/src/nvim/testdir/test_partial.vim @@ -114,6 +114,36 @@ func Test_script_function_in_dict() call assert_equal('bar', B()) endfunc +function! s:cache_arg(arg) dict + let s:result = self.name . '/' . a:arg + return s:result +endfunction + +func Test_script_function_in_dict_arg() + let s:obj = {'name': 'foo'} + let s:obj['clear'] = function('s:cache_arg') + + call assert_equal('foo/bar', s:obj.clear('bar')) + let F = s:obj.clear + let s:result = '' + call assert_equal('foo/bar', F('bar')) + call assert_equal('foo/bar', s:result) + + let s:obj['clear'] = function('s:cache_arg', ['bar']) + call assert_equal('foo/bar', s:obj.clear()) + let s:result = '' + call s:obj.clear() + call assert_equal('foo/bar', s:result) + + let F = s:obj.clear + call assert_equal('foo/bar', F()) + let s:result = '' + call F() + call assert_equal('foo/bar', s:result) + + call assert_equal('foo/bar', call(s:obj.clear, [], s:obj)) +endfunc + func Test_partial_exists() let F = function('MyFunc') call assert_true(exists('*F')) |