comparison src/testdir/test_expr.vim @ 26348:bf1a7ce3f14a v8.2.3705

patch 8.2.3705: cannot pass a lambda name to function() or funcref() Commit: https://github.com/vim/vim/commit/eba3b7f6645c8f856132b4c06a009a3b0a44e21c Author: Bram Moolenaar <Bram@vim.org> Date: Tue Nov 30 18:25:08 2021 +0000 patch 8.2.3705: cannot pass a lambda name to function() or funcref() Problem: Cannot pass a lambda name to function() or funcref(). (Yegappan Lakshmanan) Solution: Handle a lambda name differently.
author Bram Moolenaar <Bram@vim.org>
date Tue, 30 Nov 2021 19:30:05 +0100
parents ce6490cd6282
children e01607ab0fab
comparison
equal deleted inserted replaced
26347:cd04fa8a6d91 26348:bf1a7ce3f14a
545 call assert_fails("call function('s:f')", 'E700:') 545 call assert_fails("call function('s:f')", 'E700:')
546 546
547 call assert_fails("call function('foo()')", 'E475:') 547 call assert_fails("call function('foo()')", 'E475:')
548 call assert_fails("call function('foo()')", 'foo()') 548 call assert_fails("call function('foo()')", 'foo()')
549 call assert_fails("function('')", 'E129:') 549 call assert_fails("function('')", 'E129:')
550
551 let Len = {s -> strlen(s)}
552 call assert_equal(6, Len('foobar'))
553 let name = string(Len)
554 " can evaluate "function('<lambda>99')"
555 call execute('let Ref = ' .. name)
556 call assert_equal(4, Ref('text'))
550 endfunc 557 endfunc
551 558
552 func Test_funcref() 559 func Test_funcref()
553 func! One() 560 func! One()
554 return 1 561 return 1