aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/system_spec.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-11-19 22:57:13 +0000
committerJosh Rahm <joshuarahm@gmail.com>2024-11-19 22:57:13 +0000
commit9be89f131f87608f224f0ee06d199fcd09d32176 (patch)
tree11022dcfa9e08cb4ac5581b16734196128688d48 /test/functional/lua/system_spec.lua
parentff7ed8f586589d620a806c3758fac4a47a8e7e15 (diff)
parent88085c2e80a7e3ac29aabb6b5420377eed99b8b6 (diff)
downloadrneovim-9be89f131f87608f224f0ee06d199fcd09d32176.tar.gz
rneovim-9be89f131f87608f224f0ee06d199fcd09d32176.tar.bz2
rneovim-9be89f131f87608f224f0ee06d199fcd09d32176.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'test/functional/lua/system_spec.lua')
-rw-r--r--test/functional/lua/system_spec.lua32
1 files changed, 12 insertions, 20 deletions
diff --git a/test/functional/lua/system_spec.lua b/test/functional/lua/system_spec.lua
index e72a009d2e..482bfcf1a9 100644
--- a/test/functional/lua/system_spec.lua
+++ b/test/functional/lua/system_spec.lua
@@ -6,10 +6,8 @@ local exec_lua = n.exec_lua
local eq = t.eq
local function system_sync(cmd, opts)
- return exec_lua(
- [[
- local cmd, opts = ...
- local obj = vim.system(...)
+ return exec_lua(function()
+ local obj = vim.system(cmd, opts)
if opts.timeout then
-- Minor delay before calling wait() so the timeout uv timer can have a headstart over the
@@ -24,16 +22,11 @@ local function system_sync(cmd, opts)
assert(not proc, 'process still exists')
return res
- ]],
- cmd,
- opts
- )
+ end)
end
local function system_async(cmd, opts)
- return exec_lua(
- [[
- local cmd, opts = ...
+ return exec_lua(function()
_G.done = false
local obj = vim.system(cmd, opts, function(obj)
_G.done = true
@@ -51,10 +44,7 @@ local function system_async(cmd, opts)
assert(not proc, 'process still exists')
return _G.ret
- ]],
- cmd,
- opts
- )
+ end)
end
describe('vim.system', function()
@@ -84,7 +74,7 @@ describe('vim.system', function()
end
it('kill processes', function()
- exec_lua([[
+ exec_lua(function()
local signal
local cmd = vim.system({ 'cat', '-' }, { stdin = true }, function(r)
signal = r.signal
@@ -104,19 +94,21 @@ describe('vim.system', function()
assert(not proc, 'process still exists')
assert(signal == 2)
- ]])
+ end)
end)
it('SystemObj:wait() does not process non-fast events #27292', function()
eq(
false,
- exec_lua([[
+ exec_lua(function()
_G.processed = false
local cmd = vim.system({ 'sleep', '1' })
- vim.schedule(function() _G.processed = true end)
+ vim.schedule(function()
+ _G.processed = true
+ end)
cmd:wait()
return _G.processed
- ]])
+ end)
)
eq(true, exec_lua([[return _G.processed]]))
end)