aboutsummaryrefslogtreecommitdiff
path: root/test/unit/os/shell_spec.lua
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-03-05 04:02:45 +0300
committerZyX <kp-pav@yandex.ru>2017-03-11 23:23:30 +0300
commit12b062b2c862fd436cff0df4ebb2e5ca22e75e19 (patch)
tree47cb394b68714d419728e7aca87b9bac909df96f /test/unit/os/shell_spec.lua
parent5898b42d82a5a4b594879f30d84611c98ce6bd54 (diff)
downloadrneovim-12b062b2c862fd436cff0df4ebb2e5ca22e75e19.tar.gz
rneovim-12b062b2c862fd436cff0df4ebb2e5ca22e75e19.tar.bz2
rneovim-12b062b2c862fd436cff0df4ebb2e5ca22e75e19.zip
unittests: Run all unit tests in their own processes
Used sed -r -i -e '/ helpers =/ s/$/\nlocal itp = helpers.gen_itp(it)/; s/^(\s*)it\(/\1itp(/' test/unit/**/*_spec.lua to alter all tests. Locally they all run fine now. Reasoning: 1. General: state from one test should not affect other tests. 2. Local: travis build is failing with something which may be an output of garbage collector. This should prevent state of the garbage collector from interferring as well.
Diffstat (limited to 'test/unit/os/shell_spec.lua')
-rw-r--r--test/unit/os/shell_spec.lua25
1 files changed, 13 insertions, 12 deletions
diff --git a/test/unit/os/shell_spec.lua b/test/unit/os/shell_spec.lua
index 3603403daf..e51be91383 100644
--- a/test/unit/os/shell_spec.lua
+++ b/test/unit/os/shell_spec.lua
@@ -1,4 +1,5 @@
local helpers = require('test.unit.helpers')
+local itp = helpers.gen_itp(it)
local cimported = helpers.cimport(
'./src/nvim/os/shell.h',
'./src/nvim/option_defs.h',
@@ -51,21 +52,21 @@ describe('shell functions', function()
end
describe('os_system', function()
- it('can echo some output (shell builtin)', function()
+ itp('can echo some output (shell builtin)', function()
local cmd, text = 'echo -n', 'some text'
local status, output = os_system(cmd .. ' ' .. text)
eq(text, output)
eq(0, status)
end)
- it('can deal with empty output', function()
+ itp('can deal with empty output', function()
local cmd = 'echo -n'
local status, output = os_system(cmd)
eq('', output)
eq(0, status)
end)
- it('can pass input on stdin', function()
+ itp('can pass input on stdin', function()
local cmd, input = 'cat -', 'some text\nsome other text'
local status, output = os_system(cmd, input)
eq(input, output)
@@ -91,23 +92,23 @@ describe('shell functions', function()
cimported.p_shcf = saved_opts.p_shcf
end)
- it('works with NULL arguments', function()
+ itp('works with NULL arguments', function()
eq({'/bin/bash'}, shell_build_argv(nil, nil))
end)
- it('works with cmd', function()
+ itp('works with cmd', function()
eq({'/bin/bash', '-c', 'abc def'}, shell_build_argv('abc def', nil))
end)
- it('works with extra_args', function()
+ itp('works with extra_args', function()
eq({'/bin/bash', 'ghi jkl'}, shell_build_argv(nil, 'ghi jkl'))
end)
- it('works with cmd and extra_args', function()
+ itp('works with cmd and extra_args', function()
eq({'/bin/bash', 'ghi jkl', '-c', 'abc def'}, shell_build_argv('abc def', 'ghi jkl'))
end)
- it('splits and unquotes &shell and &shellcmdflag', function()
+ itp('splits and unquotes &shell and &shellcmdflag', function()
cimported.p_sh = to_cstr('/Program" "Files/zsh -f')
cimported.p_shcf = to_cstr('-x -o "sh word split" "-"c')
eq({'/Program Files/zsh', '-f',
@@ -117,7 +118,7 @@ describe('shell functions', function()
shell_build_argv('abc def', 'ghi jkl'))
end)
- it('applies shellxescape (p_sxe) and shellxquote (p_sxq)', function()
+ itp('applies shellxescape (p_sxe) and shellxquote (p_sxq)', function()
cimported.p_sxq = to_cstr('(')
cimported.p_sxe = to_cstr('"&|<>()@^')
@@ -129,7 +130,7 @@ describe('shell functions', function()
eq(nil, argv[3])
end)
- it('applies shellxquote="(', function()
+ itp('applies shellxquote="(', function()
cimported.p_sxq = to_cstr('"(')
cimported.p_sxe = to_cstr('"&|<>()@^')
@@ -141,7 +142,7 @@ describe('shell functions', function()
eq(nil, argv[3])
end)
- it('applies shellxquote="', function()
+ itp('applies shellxquote="', function()
cimported.p_sxq = to_cstr('"')
cimported.p_sxe = to_cstr('')
@@ -153,7 +154,7 @@ describe('shell functions', function()
eq(nil, argv[3])
end)
- it('with empty shellxquote/shellxescape', 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')