Mercurial > vim
diff src/testdir/test_partial.vim @ 9110:6d3888e2232c v7.4.1839
commit https://github.com/vim/vim/commit/2bbf8eff6fab16d86e7bcfc0da1962d31bec7891
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue May 24 18:37:12 2016 +0200
patch 7.4.1839
Problem: Cannot get the items stored in a partial.
Solution: Support using get() on a partial.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 24 May 2016 18:45:06 +0200 |
parents | 2242a5766417 |
children | 0cc48b3cd884 |
line wrap: on
line diff
--- a/src/testdir/test_partial.vim +++ b/src/testdir/test_partial.vim @@ -279,3 +279,12 @@ func Test_auto_partial_rebind() call assert_equal('dict1', dict2.f2()) call assert_equal('dict1', dict2['f2']()) endfunc + +func Test_get_partial_items() + let dict = {'name': 'hello'} + let Cb = function('MyDictFunc', ["foo", "bar"], dict) + call assert_equal('MyDictFunc', get(Cb, 'func')) + call assert_equal(["foo", "bar"], get(Cb, 'args')) + call assert_equal(dict, get(Cb, 'dict')) + call assert_fails('call get(Cb, "xxx")', 'E475:') +endfunc