mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 17:21:49 +00:00
test: allow exec_lua to handle functions
Problem: Tests have lots of exec_lua calls which input blocks of code provided as unformatted strings. Solution: Teach exec_lua how to handle functions.
This commit is contained in:

committed by
Lewis Russell

parent
f32557ca67
commit
7d24c4d6b0
@@ -178,13 +178,15 @@ describe(':lua', function()
|
||||
eq('hello', exec_capture(':lua = x()'))
|
||||
exec_lua('x = {a = 1, b = 2}')
|
||||
eq('{\n a = 1,\n b = 2\n}', exec_capture(':lua =x'))
|
||||
exec_lua([[function x(success)
|
||||
if success then
|
||||
return true, "Return value"
|
||||
else
|
||||
return false, nil, "Error message"
|
||||
exec_lua(function()
|
||||
function _G.x(success)
|
||||
if success then
|
||||
return true, 'Return value'
|
||||
else
|
||||
return false, nil, 'Error message'
|
||||
end
|
||||
end
|
||||
end]])
|
||||
end)
|
||||
eq(
|
||||
dedent [[
|
||||
true
|
||||
|
Reference in New Issue
Block a user