aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/vim_spec.lua
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2024-02-13 12:14:53 +0100
committerGitHub <noreply@github.com>2024-02-13 12:14:53 +0100
commitce5a9bfe7e537c81d34bd4a27fc6638f20114e67 (patch)
tree1eeeedcb0370d7c156f60ee53017149c8aac8c28 /test/functional/lua/vim_spec.lua
parent89135cff030b06f60cd596a9ae81cd9583987517 (diff)
parent1a3a8d903e9705ce41867e1cbc629a85c7cb6252 (diff)
downloadrneovim-ce5a9bfe7e537c81d34bd4a27fc6638f20114e67.tar.gz
rneovim-ce5a9bfe7e537c81d34bd4a27fc6638f20114e67.tar.bz2
rneovim-ce5a9bfe7e537c81d34bd4a27fc6638f20114e67.zip
Merge pull request #27428 from bfredl/luarena
refactor(lua): use Arena when converting from lua stack to API args
Diffstat (limited to 'test/functional/lua/vim_spec.lua')
-rw-r--r--test/functional/lua/vim_spec.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua
index c7490756d4..a262d239e8 100644
--- a/test/functional/lua/vim_spec.lua
+++ b/test/functional/lua/vim_spec.lua
@@ -3543,6 +3543,18 @@ describe('lua stdlib', function()
]])
)
end)
+
+ it('can return values by reference', function()
+ eq(
+ { 4, 7 },
+ exec_lua [[
+ local val = {4, 10}
+ local ref = vim.api.nvim_buf_call(0, function() return val end)
+ ref[2] = 7
+ return val
+ ]]
+ )
+ end)
end)
describe('vim.api.nvim_win_call', function()
@@ -3640,6 +3652,18 @@ describe('lua stdlib', function()
|
]]
end)
+
+ it('can return values by reference', function()
+ eq(
+ { 7, 10 },
+ exec_lua [[
+ local val = {4, 10}
+ local ref = vim.api.nvim_win_call(0, function() return val end)
+ ref[1] = 7
+ return val
+ ]]
+ )
+ end)
end)
describe('vim.iconv', function()