From 71497c164db3180bbec539765f987b483662f73f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 4 Oct 2022 07:31:06 +0800 Subject: test: add test for :function followed by --- test/functional/vimscript/eval_spec.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/functional/vimscript/eval_spec.lua') diff --git a/test/functional/vimscript/eval_spec.lua b/test/functional/vimscript/eval_spec.lua index d4fa7afe89..1fbdedb815 100644 --- a/test/functional/vimscript/eval_spec.lua +++ b/test/functional/vimscript/eval_spec.lua @@ -17,6 +17,7 @@ local clear = helpers.clear local eq = helpers.eq local exc_exec = helpers.exc_exec local exec = helpers.exec +local exec_capture = helpers.exec_capture local eval = helpers.eval local command = helpers.command local write_file = helpers.write_file @@ -247,3 +248,16 @@ describe("uncaught exception", function() eq('123', eval('result')) end) end) + +describe('lambda function', function() + before_each(clear) + + it('can be shown using :function followed by #20466', function() + command('let A = {-> 1}') + local num = exec_capture('echo A'):match("function%('(%d+)'%)") + eq(([[ + function %s(...) +1 return 1 + endfunction]]):format(num), exec_capture(('function %s'):format(num))) + end) +end) -- cgit