From 92e51d7e4b79913434c7b74a275babcf65098b97 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 19 Nov 2022 12:47:44 +0800 Subject: vim-patch:8.2.5167: get(Fn, 'name') on funcref returns special byte code (#21112) Problem: get(Fn, 'name') on funcref returns special byte code. Solution: Use the printable name. https://github.com/vim/vim/commit/1ae8c262df7083dfb4b41485508951c50eccc84c Cherry-pick printable_func_name() from patch 8.2.0149. Co-authored-by: Bram Moolenaar --- src/nvim/testdir/test_getvar.vim | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/nvim/testdir/test_getvar.vim') diff --git a/src/nvim/testdir/test_getvar.vim b/src/nvim/testdir/test_getvar.vim index 5a96548893..e6b6341fce 100644 --- a/src/nvim/testdir/test_getvar.vim +++ b/src/nvim/testdir/test_getvar.vim @@ -133,11 +133,20 @@ func Test_get_lambda() call assert_equal([], get(l:L, 'args')) endfunc +func s:FooBar() +endfunc + " get({func}, {what} [, {default}]) func Test_get_func() let l:F = function('tr') call assert_equal('tr', get(l:F, 'name')) call assert_equal(l:F, get(l:F, 'func')) + + let Fb_func = function('s:FooBar') + call assert_match('\d\+_FooBar', get(Fb_func, 'name')) + let Fb_ref = funcref('s:FooBar') + call assert_match('\d\+_FooBar', get(Fb_ref, 'name')) + call assert_equal({'func has': 'no dict'}, get(l:F, 'dict', {'func has': 'no dict'})) call assert_equal(0, get(l:F, 'dict')) call assert_equal([], get(l:F, 'args')) -- cgit