comparison src/testdir/test_lua.vim @ 24073:c424821dc031 v8.2.2578

patch 8.2.2578: Lua cannot handle a passed in lambda Commit: https://github.com/vim/vim/commit/86c3a2162c2e78b4f0b87b47779cc1452990ee1b Author: Bram Moolenaar <Bram@vim.org> Date: Mon Mar 8 19:50:24 2021 +0100 patch 8.2.2578: Lua cannot handle a passed in lambda Problem: Lua cannot handle a passed in lambda. Solution: Handle VAR_PARTIAL. (Prabir Shrestha, closes https://github.com/vim/vim/issues/7937, closes https://github.com/vim/vim/issues/7936)
author Bram Moolenaar <Bram@vim.org>
date Mon, 08 Mar 2021 20:00:03 +0100
parents 8da5e18effc5
children e3d72ea162c3
comparison
equal deleted inserted replaced
24072:25305dfc4c92 24073:c424821dc031
117 \ "[string \"vim chunk\"]:1: bad argument #1 to 'eval' (string expected, got function)") 117 \ "[string \"vim chunk\"]:1: bad argument #1 to 'eval' (string expected, got function)")
118 call assert_fails('lua v = vim.eval(vim.buffer())', 118 call assert_fails('lua v = vim.eval(vim.buffer())',
119 \ "[string \"vim chunk\"]:1: bad argument #1 to 'eval' (string expected, got userdata)") 119 \ "[string \"vim chunk\"]:1: bad argument #1 to 'eval' (string expected, got userdata)")
120 120
121 lua v = nil 121 lua v = nil
122 endfunc
123
124 " Test luaeval() with lambda
125 func Test_luaeval_with_lambda()
126 lua function hello_luaeval_lambda(a, cb) return a .. cb() end
127 call assert_equal('helloworld',
128 \ luaeval('hello_luaeval_lambda(_A[1], _A[2])',
129 \ ['hello', {->'world'}]))
130 lua hello_luaeval_lambda = nil
122 endfunc 131 endfunc
123 132
124 " Test vim.window() 133 " Test vim.window()
125 func Test_lua_window() 134 func Test_lua_window()
126 e Xfoo2 135 e Xfoo2