aboutsummaryrefslogtreecommitdiff
path: root/test/unit/os
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/os')
-rw-r--r--test/unit/os/fs_spec.lua13
-rw-r--r--test/unit/os/shell_spec.lua15
2 files changed, 5 insertions, 23 deletions
diff --git a/test/unit/os/fs_spec.lua b/test/unit/os/fs_spec.lua
index 1ef7d756dc..860ebfdbcb 100644
--- a/test/unit/os/fs_spec.lua
+++ b/test/unit/os/fs_spec.lua
@@ -16,10 +16,10 @@ local to_cstr = helpers.to_cstr
local OK = helpers.OK
local FAIL = helpers.FAIL
local NULL = helpers.NULL
+
local NODE_NORMAL = 0
local NODE_WRITABLE = 1
-cimport('unistd.h')
cimport('./src/nvim/os/shell.h')
cimport('./src/nvim/option_defs.h')
cimport('./src/nvim/main.h')
@@ -66,13 +66,10 @@ local function os_getperm(filename)
end
describe('fs function', function()
- local orig_test_file_perm
-
- setup(function()
+ before_each(function()
lfs.mkdir('unit-test-directory');
io.open('unit-test-directory/test.file', 'w').close()
- orig_test_file_perm = os_getperm('unit-test-directory/test.file')
io.open('unit-test-directory/test_2.file', 'w').close()
lfs.link('test.file', 'unit-test-directory/test_link.file', true)
@@ -84,7 +81,7 @@ describe('fs function', function()
directory, executable_name = string.match(absolute_executable, '^(.*)/(.*)$')
end)
- teardown(function()
+ after_each(function()
os.remove('unit-test-directory/test.file')
os.remove('unit-test-directory/test_2.file')
os.remove('unit-test-directory/test_link.file')
@@ -217,10 +214,6 @@ describe('fs function', function()
end)
describe('file permissions', function()
- before_each(function()
- os_setperm('unit-test-directory/test.file', orig_test_file_perm)
- end)
-
local function os_fchown(filename, user_id, group_id)
local fd = ffi.C.open(filename, 0)
local res = fs.os_fchown(fd, user_id, group_id)
diff --git a/test/unit/os/shell_spec.lua b/test/unit/os/shell_spec.lua
index de39477b19..e53a510f1f 100644
--- a/test/unit/os/shell_spec.lua
+++ b/test/unit/os/shell_spec.lua
@@ -11,6 +11,7 @@ local ffi, eq = helpers.ffi, helpers.eq
local intern = helpers.internalize
local to_cstr = helpers.to_cstr
local NULL = ffi.cast('void *', 0)
+local deferred_call = deferred_call
describe('shell functions', function()
before_each(function()
@@ -73,25 +74,13 @@ describe('shell functions', function()
eq(0, status)
end)
- it ('returns non-zero exit code', function()
+ itp('returns non-zero exit code', function()
local status = os_system('exit 2')
eq(2, status)
end)
end)
describe('shell_build_argv', function()
- local saved_opts = {}
-
- setup(function()
- saved_opts.p_sh = cimported.p_sh
- saved_opts.p_shcf = cimported.p_shcf
- end)
-
- teardown(function()
- cimported.p_sh = saved_opts.p_sh
- cimported.p_shcf = saved_opts.p_shcf
- end)
-
itp('works with NULL arguments', function()
eq({'/bin/bash'}, shell_build_argv(nil, nil))
end)