Mercurial > vim
comparison src/testdir/test_partial.vim @ 9117:0cc48b3cd884 v7.4.1842
commit https://github.com/vim/vim/commit/03e19a04ac2ca55643663b97b6ab94043233dcbd
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue May 24 22:29:49 2016 +0200
patch 7.4.1842
Problem: get() works for Partial but not for Funcref.
Solution: Accept Funcref. Also return the function itself. (Nikolai Pavlov)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 24 May 2016 22:30:07 +0200 |
parents | 6d3888e2232c |
children | b9c1a397a8a6 |
comparison
equal
deleted
inserted
replaced
9116:bc38030aec7d | 9117:0cc48b3cd884 |
---|---|
280 call assert_equal('dict1', dict2['f2']()) | 280 call assert_equal('dict1', dict2['f2']()) |
281 endfunc | 281 endfunc |
282 | 282 |
283 func Test_get_partial_items() | 283 func Test_get_partial_items() |
284 let dict = {'name': 'hello'} | 284 let dict = {'name': 'hello'} |
285 let Cb = function('MyDictFunc', ["foo", "bar"], dict) | 285 let args = ["foo", "bar"] |
286 call assert_equal('MyDictFunc', get(Cb, 'func')) | 286 let Func = function('MyDictFunc') |
287 call assert_equal(["foo", "bar"], get(Cb, 'args')) | 287 let Cb = function('MyDictFunc', args, dict) |
288 | |
289 call assert_equal(Func, get(Cb, 'func')) | |
290 call assert_equal('MyDictFunc', get(Cb, 'name')) | |
291 call assert_equal(args, get(Cb, 'args')) | |
288 call assert_equal(dict, get(Cb, 'dict')) | 292 call assert_equal(dict, get(Cb, 'dict')) |
289 call assert_fails('call get(Cb, "xxx")', 'E475:') | 293 call assert_fails('call get(Cb, "xxx")', 'E475:') |
290 endfunc | 294 |
295 call assert_equal(Func, get(Func, 'func')) | |
296 call assert_equal('MyDictFunc', get(Func, 'name')) | |
297 call assert_equal([], get(Func, 'args')) | |
298 call assert_true(empty( get(Func, 'dict'))) | |
299 endfunc |