aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan de Boyne Pollard <jdebp@users.noreply.github.com>2017-05-31 23:46:00 +0100
committerJustin M. Keyes <justinkz@gmail.com>2017-06-01 00:46:00 +0200
commit838277e28a6c8ea600a49292cd2837b155265dc6 (patch)
treed33d3dde93e30ff9d7332c205437b4d53db047e8
parent133f8bc628c20510571a9f6c93b61a14521327d1 (diff)
downloadrneovim-838277e28a6c8ea600a49292cd2837b155265dc6.tar.gz
rneovim-838277e28a6c8ea600a49292cd2837b155265dc6.tar.bz2
rneovim-838277e28a6c8ea600a49292cd2837b155265dc6.zip
test: fix bashisms (#6791)
-rw-r--r--test/unit/os/shell_spec.lua22
1 files changed, 11 insertions, 11 deletions
diff --git a/test/unit/os/shell_spec.lua b/test/unit/os/shell_spec.lua
index e883301cfb..37274502de 100644
--- a/test/unit/os/shell_spec.lua
+++ b/test/unit/os/shell_spec.lua
@@ -15,7 +15,7 @@ local NULL = ffi.cast('void *', 0)
describe('shell functions', function()
before_each(function()
-- os_system() can't work when the p_sh and p_shcf variables are unset
- cimported.p_sh = to_cstr('/bin/bash')
+ cimported.p_sh = to_cstr('/bin/sh')
cimported.p_shcf = to_cstr('-c')
cimported.p_sxq = to_cstr('')
cimported.p_sxe = to_cstr('')
@@ -53,14 +53,14 @@ describe('shell functions', function()
describe('os_system', function()
itp('can echo some output (shell builtin)', function()
- local cmd, text = 'echo -n', 'some text'
+ local cmd, text = 'printf "%s "', 'some text '
local status, output = os_system(cmd .. ' ' .. text)
eq(text, output)
eq(0, status)
end)
itp('can deal with empty output', function()
- local cmd = 'echo -n'
+ local cmd = 'printf ""'
local status, output = os_system(cmd)
eq('', output)
eq(0, status)
@@ -81,19 +81,19 @@ describe('shell functions', function()
describe('shell_build_argv', function()
itp('works with NULL arguments', function()
- eq({'/bin/bash'}, shell_build_argv(nil, nil))
+ eq({'/bin/sh'}, shell_build_argv(nil, nil))
end)
itp('works with cmd', function()
- eq({'/bin/bash', '-c', 'abc def'}, shell_build_argv('abc def', nil))
+ eq({'/bin/sh', '-c', 'abc def'}, shell_build_argv('abc def', nil))
end)
itp('works with extra_args', function()
- eq({'/bin/bash', 'ghi jkl'}, shell_build_argv(nil, 'ghi jkl'))
+ eq({'/bin/sh', 'ghi jkl'}, shell_build_argv(nil, 'ghi jkl'))
end)
itp('works with cmd and extra_args', function()
- eq({'/bin/bash', 'ghi jkl', '-c', 'abc def'}, shell_build_argv('abc def', 'ghi jkl'))
+ eq({'/bin/sh', 'ghi jkl', '-c', 'abc def'}, shell_build_argv('abc def', 'ghi jkl'))
end)
itp('splits and unquotes &shell and &shellcmdflag', function()
@@ -112,7 +112,7 @@ describe('shell functions', function()
local argv = ffi.cast('char**',
cimported.shell_build_argv(to_cstr('echo &|<>()@^'), nil))
- eq(ffi.string(argv[0]), '/bin/bash')
+ eq(ffi.string(argv[0]), '/bin/sh')
eq(ffi.string(argv[1]), '-c')
eq(ffi.string(argv[2]), '(echo ^&^|^<^>^(^)^@^^)')
eq(nil, argv[3])
@@ -124,7 +124,7 @@ describe('shell functions', function()
local argv = ffi.cast('char**', cimported.shell_build_argv(
to_cstr('echo -n some text'), nil))
- eq(ffi.string(argv[0]), '/bin/bash')
+ eq(ffi.string(argv[0]), '/bin/sh')
eq(ffi.string(argv[1]), '-c')
eq(ffi.string(argv[2]), '"(echo -n some text)"')
eq(nil, argv[3])
@@ -136,7 +136,7 @@ describe('shell functions', function()
local argv = ffi.cast('char**', cimported.shell_build_argv(
to_cstr('echo -n some text'), nil))
- eq(ffi.string(argv[0]), '/bin/bash')
+ eq(ffi.string(argv[0]), '/bin/sh')
eq(ffi.string(argv[1]), '-c')
eq(ffi.string(argv[2]), '"echo -n some text"')
eq(nil, argv[3])
@@ -145,7 +145,7 @@ describe('shell functions', function()
itp('with empty shellxquote/shellxescape', function()
local argv = ffi.cast('char**', cimported.shell_build_argv(
to_cstr('echo -n some text'), nil))
- eq(ffi.string(argv[0]), '/bin/bash')
+ eq(ffi.string(argv[0]), '/bin/sh')
eq(ffi.string(argv[1]), '-c')
eq(ffi.string(argv[2]), 'echo -n some text')
eq(nil, argv[3])