aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/system_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/lua/system_spec.lua')
-rw-r--r--test/functional/lua/system_spec.lua25
1 files changed, 16 insertions, 9 deletions
diff --git a/test/functional/lua/system_spec.lua b/test/functional/lua/system_spec.lua
index a988d3f0d7..bae8322b43 100644
--- a/test/functional/lua/system_spec.lua
+++ b/test/functional/lua/system_spec.lua
@@ -4,7 +4,8 @@ local exec_lua = helpers.exec_lua
local eq = helpers.eq
local function system_sync(cmd, opts)
- return exec_lua([[
+ return exec_lua(
+ [[
local cmd, opts = ...
local obj = vim.system(...)
@@ -21,11 +22,15 @@ local function system_sync(cmd, opts)
assert(not proc, 'process still exists')
return res
- ]], cmd, opts)
+ ]],
+ cmd,
+ opts
+ )
end
local function system_async(cmd, opts)
- return exec_lua([[
+ return exec_lua(
+ [[
local cmd, opts = ...
_G.done = false
local obj = vim.system(cmd, opts, function(obj)
@@ -44,7 +49,10 @@ local function system_async(cmd, opts)
assert(not proc, 'process still exists')
return _G.ret
- ]], cmd, opts)
+ ]],
+ cmd,
+ opts
+ )
end
describe('vim.system', function()
@@ -52,10 +60,10 @@ describe('vim.system', function()
clear()
end)
- for name, system in pairs{ sync = system_sync, async = system_async, } do
- describe('('..name..')', function()
+ for name, system in pairs { sync = system_sync, async = system_async } do
+ describe('(' .. name .. ')', function()
it('can run simple commands', function()
- eq('hello\n', system({'echo', 'hello' }, { text = true }).stdout)
+ eq('hello\n', system({ 'echo', 'hello' }, { text = true }).stdout)
end)
it('handle input', function()
@@ -67,7 +75,7 @@ describe('vim.system', function()
code = 124,
signal = 15,
stdout = '',
- stderr = ''
+ stderr = '',
}, system({ 'sleep', '10' }, { timeout = 1000 }))
end)
end)
@@ -96,5 +104,4 @@ describe('vim.system', function()
assert(signal == 2)
]])
end)
-
end)