aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/job/job_spec.lua7
-rw-r--r--test/functional/shell/viml_system_spec.lua9
-rw-r--r--test/unit/os/shell_spec.lua4
3 files changed, 18 insertions, 2 deletions
diff --git a/test/functional/job/job_spec.lua b/test/functional/job/job_spec.lua
index df989b3ef9..259fa52443 100644
--- a/test/functional/job/job_spec.lua
+++ b/test/functional/job/job_spec.lua
@@ -29,6 +29,13 @@ describe('jobs', function()
]])
end)
+ it('uses &shell and &shellcmdflag if passed a string', function()
+ nvim('command', "let $VAR = 'abc'")
+ nvim('command', "let j = jobstart('echo $VAR', g:job_opts)")
+ eq({'notification', 'stdout', {0, {'abc', ''}}}, next_msg())
+ eq({'notification', 'exit', {0, 0}}, next_msg())
+ end)
+
it('returns 0 when it fails to start', function()
local status, rv = pcall(eval, "jobstart([])")
eq(false, status)
diff --git a/test/functional/shell/viml_system_spec.lua b/test/functional/shell/viml_system_spec.lua
index 922770ad42..bd47d31a14 100644
--- a/test/functional/shell/viml_system_spec.lua
+++ b/test/functional/shell/viml_system_spec.lua
@@ -44,7 +44,7 @@ describe('system()', function()
eq(127, eval('v:shell_error'))
end)
- describe('executes shell function', function()
+ describe('executes shell function if passed a string', function()
local screen
before_each(function()
@@ -192,6 +192,13 @@ describe('system()', function()
end)
end)
end
+
+ describe('command passed as a list', function()
+ it('does not execute &shell', function()
+ eq('* $NOTHING ~/file',
+ eval("system(['echo', '-n', '*', '$NOTHING', '~/file'])"))
+ end)
+ end)
end)
describe('systemlist()', function()
diff --git a/test/unit/os/shell_spec.lua b/test/unit/os/shell_spec.lua
index 03aafe7e3c..91d807da0b 100644
--- a/test/unit/os/shell_spec.lua
+++ b/test/unit/os/shell_spec.lua
@@ -40,7 +40,9 @@ describe('shell functions', function()
local output = ffi.new('char *[1]')
local nread = ffi.new('size_t[1]')
- local status = shell.os_system(to_cstr(cmd), input_or, input_len, output, nread)
+ local argv = ffi.cast('char**',
+ shell.shell_build_argv(to_cstr(cmd), nil))
+ local status = shell.os_system(argv, input_or, input_len, output, nread)
return status, intern(output[0], nread[0])
end