diff src/testdir/test_vim9_script.vim @ 34773:af48c532bd88 v9.1.0263

patch 9.1.0263: Vim9: Problem with lambda blocks in enums and classes Commit: https://github.com/vim/vim/commit/3fa8f7728a47822e4efd106ab30c83c28f198b3c Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Thu Apr 4 21:42:07 2024 +0200 patch 9.1.0263: Vim9: Problem with lambda blocks in enums and classes Problem: Vim9: Problem with lambda blocks in enums and classes (Aliaksei Budavei) Solution: Support evaluating lambda blocks from a string, skip over comments (Yegappan Lakshmanan) fixes: #14350 closes: #14405 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Thu, 04 Apr 2024 22:00:04 +0200
parents 75f7b311ee25
children d1b433ed9f07
line wrap: on
line diff
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -4931,6 +4931,16 @@ def Test_for_empty_line_after_lambda()
   v9.CheckSourceSuccess(lines)
 enddef
 
+" Test for evaluating a lambda block from a string
+def Test_eval_lambda_block()
+  var lines =<< trim END
+    vim9script
+    var Fn = eval("(x: number): number => {\nreturn x * 2\n}")
+    assert_equal(6, Fn(3))
+  END
+  v9.CheckSourceSuccess(lines)
+enddef
+
 " Keep this last, it messes up highlighting.
 def Test_substitute_cmd()
   new