aboutsummaryrefslogtreecommitdiff
path: root/test/unit/os
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/os')
-rw-r--r--test/unit/os/env_spec.lua35
-rw-r--r--test/unit/os/fileio_spec.lua57
-rw-r--r--test/unit/os/fs_spec.lua183
-rw-r--r--test/unit/os/shell_spec.lua25
-rw-r--r--test/unit/os/users_spec.lua17
5 files changed, 161 insertions, 156 deletions
diff --git a/test/unit/os/env_spec.lua b/test/unit/os/env_spec.lua
index 3c2cc164c9..ba6ae65a04 100644
--- a/test/unit/os/env_spec.lua
+++ b/test/unit/os/env_spec.lua
@@ -1,4 +1,5 @@
local helpers = require('test.unit.helpers')
+local itp = helpers.gen_itp(it)
local cimport = helpers.cimport
local eq = helpers.eq
@@ -33,7 +34,7 @@ describe('env function', function()
describe('os_setenv', function()
local OK = 0
- it('sets an env variable and returns OK', function()
+ itp('sets an env variable and returns OK', function()
local name = 'NEOVIM_UNIT_TEST_SETENV_1N'
local value = 'NEOVIM_UNIT_TEST_SETENV_1V'
eq(nil, os.getenv(name))
@@ -41,7 +42,7 @@ describe('env function', function()
eq(value, os.getenv(name))
end)
- it("dosn't overwrite an env variable if overwrite is 0", function()
+ itp("dosn't overwrite an env variable if overwrite is 0", function()
local name = 'NEOVIM_UNIT_TEST_SETENV_2N'
local value = 'NEOVIM_UNIT_TEST_SETENV_2V'
local value_updated = 'NEOVIM_UNIT_TEST_SETENV_2V_UPDATED'
@@ -53,13 +54,13 @@ describe('env function', function()
end)
describe('os_setenv_append_path', function()
- it('appends /foo/bar to $PATH', function()
+ itp('appends /foo/bar to $PATH', function()
local original_path = os.getenv('PATH')
eq(true, cimp.os_setenv_append_path(to_cstr('/foo/bar/baz')))
eq(original_path..':/foo/bar', os.getenv('PATH'))
end)
- it('returns false if `fname` is not absolute', function()
+ itp('returns false if `fname` is not absolute', function()
local original_path = os.getenv('PATH')
eq(false, cimp.os_setenv_append_path(to_cstr('foo/bar/baz')))
eq(original_path, os.getenv('PATH'))
@@ -67,7 +68,7 @@ describe('env function', function()
end)
describe('os_getenv', function()
- it('reads an env variable', function()
+ itp('reads an env variable', function()
local name = 'NEOVIM_UNIT_TEST_GETENV_1N'
local value = 'NEOVIM_UNIT_TEST_GETENV_1V'
eq(NULL, os_getenv(name))
@@ -76,14 +77,14 @@ describe('env function', function()
eq(value, os_getenv(name))
end)
- it('returns NULL if the env variable is not found', function()
+ itp('returns NULL if the env variable is not found', function()
local name = 'NEOVIM_UNIT_TEST_GETENV_NOTFOUND'
return eq(NULL, os_getenv(name))
end)
end)
describe('os_unsetenv', function()
- it('unsets environment variable', function()
+ itp('unsets environment variable', function()
local name = 'TEST_UNSETENV'
local value = 'TESTVALUE'
os_setenv(name, value, 1)
@@ -95,7 +96,7 @@ describe('env function', function()
end)
describe('os_getenvname_at_index', function()
- it('returns names of environment variables', function()
+ itp('returns names of environment variables', function()
local test_name = 'NEOVIM_UNIT_TEST_GETENVNAME_AT_INDEX_1N'
local test_value = 'NEOVIM_UNIT_TEST_GETENVNAME_AT_INDEX_1V'
os_setenv(test_name, test_value, 1)
@@ -115,7 +116,7 @@ describe('env function', function()
eq(true, found_name)
end)
- it('returns NULL if the index is out of bounds', function()
+ itp('returns NULL if the index is out of bounds', function()
local huge = ffi.new('size_t', 10000)
local maxuint32 = ffi.new('size_t', 4294967295)
eq(NULL, cimp.os_getenvname_at_index(huge))
@@ -132,7 +133,7 @@ describe('env function', function()
end)
describe('os_get_pid', function()
- it('returns the process ID', function()
+ itp('returns the process ID', function()
local stat_file = io.open('/proc/self/stat')
if stat_file then
local stat_str = stat_file:read('*l')
@@ -147,7 +148,7 @@ describe('env function', function()
end)
describe('os_get_hostname', function()
- it('returns the hostname', function()
+ itp('returns the hostname', function()
local handle = io.popen('hostname')
local hostname = handle:read('*l')
handle:close()
@@ -158,7 +159,7 @@ describe('env function', function()
end)
describe('expand_env_esc', function()
- it('expands environment variables', function()
+ itp('expands environment variables', function()
local name = 'NEOVIM_UNIT_TEST_EXPAND_ENV_ESCN'
local value = 'NEOVIM_UNIT_TEST_EXPAND_ENV_ESCV'
os_setenv(name, value, 1)
@@ -175,7 +176,7 @@ describe('env function', function()
eq(output_expected, ffi.string(output_buff2))
end)
- it('expands ~ once when `one` is true', function()
+ itp('expands ~ once when `one` is true', function()
local input = '~/foo ~ foo'
local homedir = cstr(255, '')
cimp.expand_env_esc(to_cstr('~'), homedir, 255, false, true, NULL)
@@ -185,7 +186,7 @@ describe('env function', function()
eq(ffi.string(output), ffi.string(output_expected))
end)
- it('expands ~ every time when `one` is false', function()
+ itp('expands ~ every time when `one` is false', function()
local input = to_cstr('~/foo ~ foo')
local dst = cstr(255, '')
cimp.expand_env_esc(to_cstr('~'), dst, 255, false, true, NULL)
@@ -196,7 +197,7 @@ describe('env function', function()
eq(output_expected, ffi.string(output))
end)
- it('does not crash #3725', function()
+ itp('does not crash #3725', function()
local name_out = ffi.new('char[100]')
cimp.os_get_user_name(name_out, 100)
local curuser = ffi.string(name_out)
@@ -209,7 +210,7 @@ describe('env function', function()
assert.True(len < 99)
end)
- it('respects `dstlen` without expansion', function()
+ itp('respects `dstlen` without expansion', function()
local input = to_cstr('this is a very long thing that will not fit')
-- The buffer is long enough to actually contain the full input in case the
-- test fails, but we don't tell expand_env_esc that
@@ -223,7 +224,7 @@ describe('env function', function()
eq(0, output[4])
end)
- it('respects `dstlen` with expansion', function()
+ itp('respects `dstlen` with expansion', function()
local varname = to_cstr('NVIM_UNIT_TEST_EXPAND_ENV_ESC_DSTLENN')
local varval = to_cstr('NVIM_UNIT_TEST_EXPAND_ENV_ESC_DSTLENV')
cimp.os_setenv(varname, varval, 1)
diff --git a/test/unit/os/fileio_spec.lua b/test/unit/os/fileio_spec.lua
index 5358022422..9833614ca0 100644
--- a/test/unit/os/fileio_spec.lua
+++ b/test/unit/os/fileio_spec.lua
@@ -1,6 +1,7 @@
local lfs = require('lfs')
local helpers = require('test.unit.helpers')
+local itp = helpers.gen_itp(it)
local eq = helpers.eq
local ffi = helpers.ffi
@@ -88,7 +89,7 @@ local function file_skip(fp, size)
end
describe('file_open', function()
- it('can create a rwx------ file with kFileCreate', function()
+ itp('can create a rwx------ file with kFileCreate', function()
local err, fp = file_open(filec, m.kFileCreate, 448)
eq(0, err)
local attrs = lfs.attributes(filec)
@@ -96,7 +97,7 @@ describe('file_open', function()
eq(0, m.file_close(fp))
end)
- it('can create a rw------- file with kFileCreate', function()
+ itp('can create a rw------- file with kFileCreate', function()
local err, fp = file_open(filec, m.kFileCreate, 384)
eq(0, err)
local attrs = lfs.attributes(filec)
@@ -104,7 +105,7 @@ describe('file_open', function()
eq(0, m.file_close(fp))
end)
- it('can create a rwx------ file with kFileCreateOnly', function()
+ itp('can create a rwx------ file with kFileCreateOnly', function()
local err, fp = file_open(filec, m.kFileCreateOnly, 448)
eq(0, err)
local attrs = lfs.attributes(filec)
@@ -112,7 +113,7 @@ describe('file_open', function()
eq(0, m.file_close(fp))
end)
- it('can create a rw------- file with kFileCreateOnly', function()
+ itp('can create a rw------- file with kFileCreateOnly', function()
local err, fp = file_open(filec, m.kFileCreateOnly, 384)
eq(0, err)
local attrs = lfs.attributes(filec)
@@ -120,47 +121,47 @@ describe('file_open', function()
eq(0, m.file_close(fp))
end)
- it('fails to open an existing file with kFileCreateOnly', function()
+ itp('fails to open an existing file with kFileCreateOnly', function()
local err, _ = file_open(file1, m.kFileCreateOnly, 384)
eq(m.UV_EEXIST, err)
end)
- it('fails to open an symlink with kFileNoSymlink', function()
+ itp('fails to open an symlink with kFileNoSymlink', function()
local err, _ = file_open(linkf, m.kFileNoSymlink, 384)
-- err is UV_EMLINK in FreeBSD, but if I use `ok(err == m.UV_ELOOP or err ==
-- m.UV_EMLINK)`, then I loose the ability to see actual `err` value.
if err ~= m.UV_ELOOP then eq(m.UV_EMLINK, err) end
end)
- it('can open an existing file write-only with kFileCreate', function()
+ itp('can open an existing file write-only with kFileCreate', function()
local err, fp = file_open(file1, m.kFileCreate, 384)
eq(0, err)
eq(true, fp.wr)
eq(0, m.file_close(fp))
end)
- it('can open an existing file read-only with zero', function()
+ itp('can open an existing file read-only with zero', function()
local err, fp = file_open(file1, 0, 384)
eq(0, err)
eq(false, fp.wr)
eq(0, m.file_close(fp))
end)
- it('can open an existing file read-only with kFileReadOnly', function()
+ itp('can open an existing file read-only with kFileReadOnly', function()
local err, fp = file_open(file1, m.kFileReadOnly, 384)
eq(0, err)
eq(false, fp.wr)
eq(0, m.file_close(fp))
end)
- it('can open an existing file read-only with kFileNoSymlink', function()
+ itp('can open an existing file read-only with kFileNoSymlink', function()
local err, fp = file_open(file1, m.kFileNoSymlink, 384)
eq(0, err)
eq(false, fp.wr)
eq(0, m.file_close(fp))
end)
- it('can truncate an existing file with kFileTruncate', function()
+ itp('can truncate an existing file with kFileTruncate', function()
local err, fp = file_open(file1, m.kFileTruncate, 384)
eq(0, err)
eq(true, fp.wr)
@@ -169,7 +170,7 @@ describe('file_open', function()
eq(0, attrs.size)
end)
- it('can open an existing file write-only with kFileWriteOnly', function()
+ itp('can open an existing file write-only with kFileWriteOnly', function()
local err, fp = file_open(file1, m.kFileWriteOnly, 384)
eq(0, err)
eq(true, fp.wr)
@@ -178,14 +179,14 @@ describe('file_open', function()
eq(4096, attrs.size)
end)
- it('fails to create a file with just kFileWriteOnly', function()
+ itp('fails to create a file with just kFileWriteOnly', function()
local err, _ = file_open(filec, m.kFileWriteOnly, 384)
eq(m.UV_ENOENT, err)
local attrs = lfs.attributes(filec)
eq(nil, attrs)
end)
- it('can truncate an existing file with kFileTruncate when opening a symlink',
+ itp('can truncate an existing file with kFileTruncate when opening a symlink',
function()
local err, fp = file_open(linkf, m.kFileTruncate, 384)
eq(0, err)
@@ -195,31 +196,31 @@ describe('file_open', function()
eq(0, attrs.size)
end)
- it('fails to open a directory write-only', function()
+ itp('fails to open a directory write-only', function()
local err, _ = file_open(dir, m.kFileWriteOnly, 384)
eq(m.UV_EISDIR, err)
end)
- it('fails to open a broken symbolic link write-only', function()
+ itp('fails to open a broken symbolic link write-only', function()
local err, _ = file_open(linkb, m.kFileWriteOnly, 384)
eq(m.UV_ENOENT, err)
end)
- it('fails to open a broken symbolic link read-only', function()
+ itp('fails to open a broken symbolic link read-only', function()
local err, _ = file_open(linkb, m.kFileReadOnly, 384)
eq(m.UV_ENOENT, err)
end)
end)
describe('file_open_new', function()
- it('can open a file read-only', function()
+ itp('can open a file read-only', function()
local err, fp = file_open_new(file1, 0, 384)
eq(0, err)
eq(false, fp.wr)
eq(0, m.file_free(fp))
end)
- it('fails to open an existing file with kFileCreateOnly', function()
+ itp('fails to open an existing file with kFileCreateOnly', function()
local err, fp = file_open_new(file1, m.kFileCreateOnly, 384)
eq(m.UV_EEXIST, err)
eq(nil, fp)
@@ -229,7 +230,7 @@ end)
-- file_close is called above, so it is not tested directly
describe('file_fsync', function()
- it('can flush writes to disk', function()
+ itp('can flush writes to disk', function()
local err, fp = file_open(filec, m.kFileCreateOnly, 384)
eq(0, file_fsync(fp))
eq(0, err)
@@ -244,7 +245,7 @@ describe('file_fsync', function()
end)
describe('file_read', function()
- it('can read small chunks of input until eof', function()
+ itp('can read small chunks of input until eof', function()
local err, fp = file_open(file1, 0, 384)
eq(0, err)
eq(false, fp.wr)
@@ -264,7 +265,7 @@ describe('file_read', function()
eq(0, m.file_close(fp))
end)
- it('can read the whole file at once', function()
+ itp('can read the whole file at once', function()
local err, fp = file_open(file1, 0, 384)
eq(0, err)
eq(false, fp.wr)
@@ -273,7 +274,7 @@ describe('file_read', function()
eq(0, m.file_close(fp))
end)
- it('can read more then 1024 bytes after reading a small chunk', function()
+ itp('can read more then 1024 bytes after reading a small chunk', function()
local err, fp = file_open(file1, 0, 384)
eq(0, err)
eq(false, fp.wr)
@@ -283,7 +284,7 @@ describe('file_read', function()
eq(0, m.file_close(fp))
end)
- it('can read file by 768-byte-chunks', function()
+ itp('can read file by 768-byte-chunks', function()
local err, fp = file_open(file1, 0, 384)
eq(0, err)
eq(false, fp.wr)
@@ -305,7 +306,7 @@ describe('file_read', function()
end)
describe('file_write', function()
- it('can write the whole file at once', function()
+ itp('can write the whole file at once', function()
local err, fp = file_open(filec, m.kFileCreateOnly, 384)
eq(0, err)
eq(true, fp.wr)
@@ -316,7 +317,7 @@ describe('file_write', function()
eq(fcontents, io.open(filec):read('*a'))
end)
- it('can write the whole file by small chunks', function()
+ itp('can write the whole file by small chunks', function()
local err, fp = file_open(filec, m.kFileCreateOnly, 384)
eq(0, err)
eq(true, fp.wr)
@@ -333,7 +334,7 @@ describe('file_write', function()
eq(fcontents, io.open(filec):read('*a'))
end)
- it('can write the whole file by 768-byte-chunks', function()
+ itp('can write the whole file by 768-byte-chunks', function()
local err, fp = file_open(filec, m.kFileCreateOnly, 384)
eq(0, err)
eq(true, fp.wr)
@@ -352,7 +353,7 @@ describe('file_write', function()
end)
describe('file_skip', function()
- it('can skip 3 bytes', function()
+ itp('can skip 3 bytes', function()
local err, fp = file_open(file1, 0, 384)
eq(0, err)
eq(false, fp.wr)
diff --git a/test/unit/os/fs_spec.lua b/test/unit/os/fs_spec.lua
index 516fb5a7d1..b0741c4592 100644
--- a/test/unit/os/fs_spec.lua
+++ b/test/unit/os/fs_spec.lua
@@ -2,6 +2,7 @@ local lfs = require('lfs')
local bit = require('bit')
local helpers = require('test.unit.helpers')
+local itp = helpers.gen_itp(it)
local cimport = helpers.cimport
local cppimport = helpers.cppimport
@@ -104,13 +105,13 @@ describe('fs function', function()
buffer = cstr(length, '')
end)
- it('returns OK and writes current directory into the buffer if it is large\n enough', function()
+ itp('returns OK and writes current directory into the buffer if it is large\n enough', function()
eq(OK, (os_dirname(buffer, length)))
eq(lfs.currentdir(), (ffi.string(buffer)))
end)
-- What kind of other failing cases are possible?
- it('returns FAIL if the buffer is too small', function()
+ itp('returns FAIL if the buffer is too small', function()
local buf = cstr((length - 1), '')
eq(FAIL, (os_dirname(buf, (length - 1))))
end)
@@ -121,35 +122,35 @@ describe('fs function', function()
end
describe('os_isdir', function()
- it('returns false if an empty string is given', function()
+ itp('returns false if an empty string is given', function()
eq(false, (os_isdir('')))
end)
- it('returns false if a nonexisting directory is given', function()
+ itp('returns false if a nonexisting directory is given', function()
eq(false, (os_isdir('non-existing-directory')))
end)
- it('returns false if a nonexisting absolute directory is given', function()
+ itp('returns false if a nonexisting absolute directory is given', function()
eq(false, (os_isdir('/non-existing-directory')))
end)
- it('returns false if an existing file is given', function()
+ itp('returns false if an existing file is given', function()
eq(false, (os_isdir('unit-test-directory/test.file')))
end)
- it('returns true if the current directory is given', function()
+ itp('returns true if the current directory is given', function()
eq(true, (os_isdir('.')))
end)
- it('returns true if the parent directory is given', function()
+ itp('returns true if the parent directory is given', function()
eq(true, (os_isdir('..')))
end)
- it('returns true if an arbitrary directory is given', function()
+ itp('returns true if an arbitrary directory is given', function()
eq(true, (os_isdir('unit-test-directory')))
end)
- it('returns true if an absolute directory is given', function()
+ itp('returns true if an absolute directory is given', function()
eq(true, (os_isdir(directory)))
end)
end)
@@ -179,24 +180,24 @@ describe('fs function', function()
return os_can_exe(name)
end
- it('returns false when given a directory', function()
+ itp('returns false when given a directory', function()
cant_exe('./unit-test-directory')
end)
- it('returns false when given a regular file without executable bit set', function()
+ itp('returns false when given a regular file without executable bit set', function()
cant_exe('unit-test-directory/test.file')
end)
- it('returns false when the given file does not exists', function()
+ itp('returns false when the given file does not exists', function()
cant_exe('does-not-exist.file')
end)
- it('returns the absolute path when given an executable inside $PATH', function()
+ itp('returns the absolute path when given an executable inside $PATH', function()
local fullpath = exe('ls')
eq(1, fs.path_is_absolute_path(to_cstr(fullpath)))
end)
- it('returns the absolute path when given an executable relative to the current dir', function()
+ itp('returns the absolute path when given an executable relative to the current dir', function()
local old_dir = lfs.currentdir()
lfs.chdir(directory)
@@ -240,22 +241,22 @@ describe('fs function', function()
end
describe('os_getperm', function()
- it('returns UV_ENOENT when the given file does not exist', function()
+ itp('returns UV_ENOENT when the given file does not exist', function()
eq(ffi.C.UV_ENOENT, (os_getperm('non-existing-file')))
end)
- it('returns a perm > 0 when given an existing file', function()
+ itp('returns a perm > 0 when given an existing file', function()
assert.is_true((os_getperm('unit-test-directory')) > 0)
end)
- it('returns S_IRUSR when the file is readable', function()
+ itp('returns S_IRUSR when the file is readable', function()
local perm = os_getperm('unit-test-directory')
assert.is_true((bit_set(perm, ffi.C.kS_IRUSR)))
end)
end)
describe('os_setperm', function()
- it('can set and unset the executable bit of a file', function()
+ itp('can set and unset the executable bit of a file', function()
local perm = os_getperm('unit-test-directory/test.file')
perm = unset_bit(perm, ffi.C.kS_IXUSR)
eq(OK, (os_setperm('unit-test-directory/test.file', perm)))
@@ -267,7 +268,7 @@ describe('fs function', function()
assert.is_true((bit_set(perm, ffi.C.kS_IXUSR)))
end)
- it('fails if given file does not exist', function()
+ itp('fails if given file does not exist', function()
local perm = ffi.C.kS_IXUSR
eq(FAIL, (os_setperm('non-existing-file', perm)))
end)
@@ -275,7 +276,7 @@ describe('fs function', function()
describe('os_fchown', function()
local filename = 'unit-test-directory/test.file'
- it('does not change owner and group if respective IDs are equal to -1', function()
+ itp('does not change owner and group if respective IDs are equal to -1', function()
local uid = lfs.attributes(filename, 'uid')
local gid = lfs.attributes(filename, 'gid')
eq(0, os_fchown(filename, -1, -1))
@@ -287,7 +288,7 @@ describe('fs function', function()
if (os.execute('id -G > /dev/null 2>&1') ~= 0) then
pending('skipped (missing `id` utility)', function() end)
else
- it('owner of a file may change the group of the file to any group of which that owner is a member', function()
+ itp('owner of a file may change the group of the file to any group of which that owner is a member', function()
local file_gid = lfs.attributes(filename, 'gid')
-- Gets ID of any group of which current user is a member except the
@@ -311,7 +312,7 @@ describe('fs function', function()
if (ffi.os == 'Windows' or ffi.C.geteuid() == 0) then
pending('skipped (uv_fs_chown is no-op on Windows)', function() end)
else
- it('returns nonzero if process has not enough permissions', function()
+ itp('returns nonzero if process has not enough permissions', function()
-- chown to root
neq(0, os_fchown(filename, 0, 0))
end)
@@ -320,7 +321,7 @@ describe('fs function', function()
describe('os_file_is_readable', function()
- it('returns false if the file is not readable', function()
+ itp('returns false if the file is not readable', function()
local perm = os_getperm('unit-test-directory/test.file')
perm = unset_bit(perm, ffi.C.kS_IRUSR)
perm = unset_bit(perm, ffi.C.kS_IRGRP)
@@ -329,19 +330,19 @@ describe('fs function', function()
eq(false, os_file_is_readable('unit-test-directory/test.file'))
end)
- it('returns false if the file does not exist', function()
+ itp('returns false if the file does not exist', function()
eq(false, os_file_is_readable(
'unit-test-directory/what_are_you_smoking.gif'))
end)
- it('returns true if the file is readable', function()
+ itp('returns true if the file is readable', function()
eq(true, os_file_is_readable(
'unit-test-directory/test.file'))
end)
end)
describe('os_file_is_writable', function()
- it('returns 0 if the file is readonly', function()
+ itp('returns 0 if the file is readonly', function()
local perm = os_getperm('unit-test-directory/test.file')
perm = unset_bit(perm, ffi.C.kS_IWUSR)
perm = unset_bit(perm, ffi.C.kS_IWGRP)
@@ -350,11 +351,11 @@ describe('fs function', function()
eq(0, os_file_is_writable('unit-test-directory/test.file'))
end)
- it('returns 1 if the file is writable', function()
+ itp('returns 1 if the file is writable', function()
eq(1, os_file_is_writable('unit-test-directory/test.file'))
end)
- it('returns 2 when given a folder with rights to write into', function()
+ itp('returns 2 when given a folder with rights to write into', function()
eq(2, os_file_is_writable('unit-test-directory'))
end)
end)
@@ -420,19 +421,19 @@ describe('fs function', function()
end
describe('os_path_exists', function()
- it('returns false when given a non-existing file', function()
+ itp('returns false when given a non-existing file', function()
eq(false, (os_path_exists('non-existing-file')))
end)
- it('returns true when given an existing file', function()
+ itp('returns true when given an existing file', function()
eq(true, (os_path_exists('unit-test-directory/test.file')))
end)
- it('returns false when given a broken symlink', function()
+ itp('returns false when given a broken symlink', function()
eq(false, (os_path_exists('unit-test-directory/test_broken_link.file')))
end)
- it('returns true when given a directory', function()
+ itp('returns true when given a directory', function()
eq(true, (os_path_exists('unit-test-directory')))
end)
end)
@@ -441,18 +442,18 @@ describe('fs function', function()
local test = 'unit-test-directory/test.file'
local not_exist = 'unit-test-directory/not_exist.file'
- it('can rename file if destination file does not exist', function()
+ itp('can rename file if destination file does not exist', function()
eq(OK, (os_rename(test, not_exist)))
eq(false, (os_path_exists(test)))
eq(true, (os_path_exists(not_exist)))
eq(OK, (os_rename(not_exist, test))) -- restore test file
end)
- it('fail if source file does not exist', function()
+ itp('fail if source file does not exist', function()
eq(FAIL, (os_rename(not_exist, test)))
end)
- it('can overwrite destination file if it exists', function()
+ itp('can overwrite destination file if it exists', function()
local other = 'unit-test-directory/other.file'
local file = io.open(other, 'w')
file:write('other')
@@ -477,11 +478,11 @@ describe('fs function', function()
os.remove('unit-test-directory/test_remove.file')
end)
- it('returns non-zero when given a non-existing file', function()
+ itp('returns non-zero when given a non-existing file', function()
neq(0, (os_remove('non-existing-file')))
end)
- it('removes the given file and returns 0', function()
+ itp('removes the given file and returns 0', function()
local f = 'unit-test-directory/test_remove.file'
assert_file_exists(f)
eq(0, (os_remove(f)))
@@ -502,30 +503,30 @@ describe('fs function', function()
os.remove(new_file)
end)
- it('returns UV_ENOENT for O_RDWR on a non-existing file', function()
+ itp('returns UV_ENOENT for O_RDWR on a non-existing file', function()
eq(ffi.C.UV_ENOENT, (os_open('non-existing-file', ffi.C.kO_RDWR, 0)))
end)
- it('returns non-negative for O_CREAT on a non-existing file which then can be closed', function()
+ itp('returns non-negative for O_CREAT on a non-existing file which then can be closed', function()
assert_file_does_not_exist(new_file)
local fd = os_open(new_file, ffi.C.kO_CREAT, 0)
assert.is_true(0 <= fd)
eq(0, os_close(fd))
end)
- it('returns non-negative for O_CREAT on a existing file which then can be closed', function()
+ itp('returns non-negative for O_CREAT on a existing file which then can be closed', function()
assert_file_exists(existing_file)
local fd = os_open(existing_file, ffi.C.kO_CREAT, 0)
assert.is_true(0 <= fd)
eq(0, os_close(fd))
end)
- it('returns UV_EEXIST for O_CREAT|O_EXCL on a existing file', function()
+ itp('returns UV_EEXIST for O_CREAT|O_EXCL on a existing file', function()
assert_file_exists(existing_file)
eq(ffi.C.kUV_EEXIST, (os_open(existing_file, (bit.bor(ffi.C.kO_CREAT, ffi.C.kO_EXCL)), 0)))
end)
- it('sets `rwx` permissions for O_CREAT 700 which then can be closed', function()
+ itp('sets `rwx` permissions for O_CREAT 700 which then can be closed', function()
assert_file_does_not_exist(new_file)
--create the file
local fd = os_open(new_file, ffi.C.kO_CREAT, tonumber("700", 8))
@@ -534,7 +535,7 @@ describe('fs function', function()
eq(0, os_close(fd))
end)
- it('sets `rw` permissions for O_CREAT 600 which then can be closed', function()
+ itp('sets `rw` permissions for O_CREAT 600 which then can be closed', function()
assert_file_does_not_exist(new_file)
--create the file
local fd = os_open(new_file, ffi.C.kO_CREAT, tonumber("600", 8))
@@ -543,7 +544,7 @@ describe('fs function', function()
eq(0, os_close(fd))
end)
- it('returns a non-negative file descriptor for an existing file which then can be closed', function()
+ itp('returns a non-negative file descriptor for an existing file which then can be closed', function()
local fd = os_open(existing_file, ffi.C.kO_RDWR, 0)
assert.is_true(0 <= fd)
eq(0, os_close(fd))
@@ -551,7 +552,7 @@ describe('fs function', function()
end)
describe('os_close', function()
- it('returns EBADF for negative file descriptors', function()
+ itp('returns EBADF for negative file descriptors', function()
eq(ffi.C.UV_EBADF, os_close(-1))
eq(ffi.C.UV_EBADF, os_close(-1000))
end)
@@ -570,7 +571,7 @@ describe('fs function', function()
os.remove(file)
end)
- it('can read zero bytes from a file', function()
+ itp('can read zero bytes from a file', function()
local fd = os_open(file, ffi.C.kO_RDONLY, 0)
ok(fd >= 0)
eq({false, 0, ''}, {os_read(fd, nil)})
@@ -578,7 +579,7 @@ describe('fs function', function()
eq(0, os_close(fd))
end)
- it('can read from a file multiple times', function()
+ itp('can read from a file multiple times', function()
local fd = os_open(file, ffi.C.kO_RDONLY, 0)
ok(fd >= 0)
eq({false, 2, '\000\001'}, {os_read(fd, 2)})
@@ -586,7 +587,7 @@ describe('fs function', function()
eq(0, os_close(fd))
end)
- it('can read the whole file at once and then report eof', function()
+ itp('can read the whole file at once and then report eof', function()
local fd = os_open(file, ffi.C.kO_RDONLY, 0)
ok(fd >= 0)
eq({false, #fcontents, fcontents}, {os_read(fd, #fcontents)})
@@ -594,7 +595,7 @@ describe('fs function', function()
eq(0, os_close(fd))
end)
- it('can read the whole file in two calls, one partially', function()
+ itp('can read the whole file in two calls, one partially', function()
local fd = os_open(file, ffi.C.kO_RDONLY, 0)
ok(fd >= 0)
eq({false, #fcontents * 3/4, fcontents:sub(1, #fcontents * 3/4)},
@@ -624,7 +625,7 @@ describe('fs function', function()
os.remove(file)
end)
- it('can read zero bytes from a file', function()
+ itp('can read zero bytes from a file', function()
local fd = os_open(file, ffi.C.kO_RDONLY, 0)
ok(fd >= 0)
eq({false, 0, {}}, {os_readv(fd, {})})
@@ -632,7 +633,7 @@ describe('fs function', function()
eq(0, os_close(fd))
end)
- it('can read from a file multiple times to a differently-sized buffers', function()
+ itp('can read from a file multiple times to a differently-sized buffers', function()
local fd = os_open(file, ffi.C.kO_RDONLY, 0)
ok(fd >= 0)
eq({false, 2, {'\000\001'}}, {os_readv(fd, {2})})
@@ -640,7 +641,7 @@ describe('fs function', function()
eq(0, os_close(fd))
end)
- it('can read the whole file at once and then report eof', function()
+ itp('can read the whole file at once and then report eof', function()
local fd = os_open(file, ffi.C.kO_RDONLY, 0)
ok(fd >= 0)
eq({false,
@@ -657,7 +658,7 @@ describe('fs function', function()
eq(0, os_close(fd))
end)
- it('can read the whole file in two calls, one partially', function()
+ itp('can read the whole file in two calls, one partially', function()
local fd = os_open(file, ffi.C.kO_RDONLY, 0)
ok(fd >= 0)
eq({false, #fcontents * 3/4, {fcontents:sub(1, #fcontents * 3/4)}},
@@ -684,7 +685,7 @@ describe('fs function', function()
os.remove(file)
end)
- it('can write zero bytes to a file', function()
+ itp('can write zero bytes to a file', function()
local fd = os_open(file, ffi.C.kO_WRONLY, 0)
ok(fd >= 0)
eq(0, os_write(fd, ''))
@@ -693,7 +694,7 @@ describe('fs function', function()
eq(0, os_close(fd))
end)
- it('can write some data to a file', function()
+ itp('can write some data to a file', function()
local fd = os_open(file, ffi.C.kO_WRONLY, 0)
ok(fd >= 0)
eq(3, os_write(fd, 'abc'))
@@ -708,11 +709,11 @@ describe('fs function', function()
os.remove('non-existing-file')
end)
- it('returns NODE_NORMAL for non-existing file', function()
+ itp('returns NODE_NORMAL for non-existing file', function()
eq(NODE_NORMAL, fs.os_nodetype(to_cstr('non-existing-file')))
end)
- it('returns NODE_WRITABLE for /dev/stderr', function()
+ itp('returns NODE_WRITABLE for /dev/stderr', function()
eq(NODE_WRITABLE, fs.os_nodetype(to_cstr('/dev/stderr')))
end)
end)
@@ -738,12 +739,12 @@ describe('fs function', function()
end
describe('os_mkdir', function()
- it('returns non-zero when given an already existing directory', function()
+ itp('returns non-zero when given an already existing directory', function()
local mode = ffi.C.kS_IRUSR + ffi.C.kS_IWUSR + ffi.C.kS_IXUSR
neq(0, (os_mkdir('unit-test-directory', mode)))
end)
- it('creates a directory and returns 0', function()
+ itp('creates a directory and returns 0', function()
local mode = ffi.C.kS_IRUSR + ffi.C.kS_IWUSR + ffi.C.kS_IXUSR
eq(false, (os_isdir('unit-test-directory/new-dir')))
eq(0, (os_mkdir('unit-test-directory/new-dir', mode)))
@@ -753,14 +754,14 @@ describe('fs function', function()
end)
describe('os_mkdir_recurse', function()
- it('returns zero when given an already existing directory', function()
+ itp('returns zero when given an already existing directory', function()
local mode = ffi.C.kS_IRUSR + ffi.C.kS_IWUSR + ffi.C.kS_IXUSR
local ret, failed_str = os_mkdir_recurse('unit-test-directory', mode)
eq(0, ret)
eq(nil, failed_str)
end)
- it('fails to create a directory where there is a file', function()
+ itp('fails to create a directory where there is a file', function()
local mode = ffi.C.kS_IRUSR + ffi.C.kS_IWUSR + ffi.C.kS_IXUSR
local ret, failed_str = os_mkdir_recurse(
'unit-test-directory/test.file', mode)
@@ -768,7 +769,7 @@ describe('fs function', function()
eq('unit-test-directory/test.file', failed_str)
end)
- it('fails to create a directory where there is a file in path', function()
+ itp('fails to create a directory where there is a file in path', function()
local mode = ffi.C.kS_IRUSR + ffi.C.kS_IWUSR + ffi.C.kS_IXUSR
local ret, failed_str = os_mkdir_recurse(
'unit-test-directory/test.file/test', mode)
@@ -776,7 +777,7 @@ describe('fs function', function()
eq('unit-test-directory/test.file', failed_str)
end)
- it('succeeds to create a directory', function()
+ itp('succeeds to create a directory', function()
local mode = ffi.C.kS_IRUSR + ffi.C.kS_IWUSR + ffi.C.kS_IXUSR
local ret, failed_str = os_mkdir_recurse(
'unit-test-directory/new-dir-recurse', mode)
@@ -787,7 +788,7 @@ describe('fs function', function()
eq(false, os_isdir('unit-test-directory/new-dir-recurse'))
end)
- it('succeeds to create a directory ending with ///', function()
+ itp('succeeds to create a directory ending with ///', function()
local mode = ffi.C.kS_IRUSR + ffi.C.kS_IWUSR + ffi.C.kS_IXUSR
local ret, failed_str = os_mkdir_recurse(
'unit-test-directory/new-dir-recurse///', mode)
@@ -798,7 +799,7 @@ describe('fs function', function()
eq(false, os_isdir('unit-test-directory/new-dir-recurse'))
end)
- it('succeeds to create a directory ending with /', function()
+ itp('succeeds to create a directory ending with /', function()
local mode = ffi.C.kS_IRUSR + ffi.C.kS_IWUSR + ffi.C.kS_IXUSR
local ret, failed_str = os_mkdir_recurse(
'unit-test-directory/new-dir-recurse/', mode)
@@ -809,7 +810,7 @@ describe('fs function', function()
eq(false, os_isdir('unit-test-directory/new-dir-recurse'))
end)
- it('succeeds to create a directory tree', function()
+ itp('succeeds to create a directory tree', function()
local mode = ffi.C.kS_IRUSR + ffi.C.kS_IWUSR + ffi.C.kS_IXUSR
local ret, failed_str = os_mkdir_recurse(
'unit-test-directory/new-dir-recurse/1/2/3', mode)
@@ -828,11 +829,11 @@ describe('fs function', function()
end)
describe('os_rmdir', function()
- it('returns non_zero when given a non-existing directory', function()
+ itp('returns non_zero when given a non-existing directory', function()
neq(0, (os_rmdir('non-existing-directory')))
end)
- it('removes the given directory and returns 0', function()
+ itp('removes the given directory and returns 0', function()
lfs.mkdir('unit-test-directory/new-dir')
eq(0, os_rmdir('unit-test-directory/new-dir'))
eq(false, (os_isdir('unit-test-directory/new-dir')))
@@ -860,19 +861,19 @@ describe('fs function', function()
end
describe('os_fileinfo', function()
- it('returns false if given a non-existing file', function()
+ itp('returns false if given a non-existing file', function()
local file_info = file_info_new()
assert.is_false((fs.os_fileinfo('/non-existent', file_info)))
end)
- it('returns true if given an existing file and fills file_info', function()
+ itp('returns true if given an existing file and fills file_info', function()
local file_info = file_info_new()
local path = 'unit-test-directory/test.file'
assert.is_true((fs.os_fileinfo(path, file_info)))
assert.is_true((is_file_info_filled(file_info)))
end)
- it('returns the file info of the linked file, not the link', function()
+ itp('returns the file info of the linked file, not the link', function()
local file_info = file_info_new()
local path = 'unit-test-directory/test_link.file'
assert.is_true((fs.os_fileinfo(path, file_info)))
@@ -883,19 +884,19 @@ describe('fs function', function()
end)
describe('os_fileinfo_link', function()
- it('returns false if given a non-existing file', function()
+ itp('returns false if given a non-existing file', function()
local file_info = file_info_new()
assert.is_false((fs.os_fileinfo_link('/non-existent', file_info)))
end)
- it('returns true if given an existing file and fills file_info', function()
+ itp('returns true if given an existing file and fills file_info', function()
local file_info = file_info_new()
local path = 'unit-test-directory/test.file'
assert.is_true((fs.os_fileinfo_link(path, file_info)))
assert.is_true((is_file_info_filled(file_info)))
end)
- it('returns the file info of the link, not the linked file', function()
+ itp('returns the file info of the link, not the linked file', function()
local file_info = file_info_new()
local path = 'unit-test-directory/test_link.file'
assert.is_true((fs.os_fileinfo_link(path, file_info)))
@@ -906,12 +907,12 @@ describe('fs function', function()
end)
describe('os_fileinfo_fd', function()
- it('returns false if given an invalid file descriptor', function()
+ itp('returns false if given an invalid file descriptor', function()
local file_info = file_info_new()
assert.is_false((fs.os_fileinfo_fd(-1, file_info)))
end)
- it('returns true if given a file descriptor and fills file_info', function()
+ itp('returns true if given a file descriptor and fills file_info', function()
local file_info = file_info_new()
local path = 'unit-test-directory/test.file'
local fd = ffi.C.open(path, 0)
@@ -922,7 +923,7 @@ describe('fs function', function()
end)
describe('os_fileinfo_id_equal', function()
- it('returns false if file infos represent different files', function()
+ itp('returns false if file infos represent different files', function()
local file_info_1 = file_info_new()
local file_info_2 = file_info_new()
local path_1 = 'unit-test-directory/test.file'
@@ -932,7 +933,7 @@ describe('fs function', function()
assert.is_false((fs.os_fileinfo_id_equal(file_info_1, file_info_2)))
end)
- it('returns true if file infos represent the same file', function()
+ itp('returns true if file infos represent the same file', function()
local file_info_1 = file_info_new()
local file_info_2 = file_info_new()
local path = 'unit-test-directory/test.file'
@@ -941,7 +942,7 @@ describe('fs function', function()
assert.is_true((fs.os_fileinfo_id_equal(file_info_1, file_info_2)))
end)
- it('returns true if file infos represent the same file (symlink)', function()
+ itp('returns true if file infos represent the same file (symlink)', function()
local file_info_1 = file_info_new()
local file_info_2 = file_info_new()
local path_1 = 'unit-test-directory/test.file'
@@ -953,7 +954,7 @@ describe('fs function', function()
end)
describe('os_fileinfo_id', function()
- it('extracts ino/dev from file_info into file_id', function()
+ itp('extracts ino/dev from file_info into file_id', function()
local file_info = file_info_new()
local file_id = file_id_new()
local path = 'unit-test-directory/test.file'
@@ -965,7 +966,7 @@ describe('fs function', function()
end)
describe('os_fileinfo_inode', function()
- it('returns the inode from file_info', function()
+ itp('returns the inode from file_info', function()
local file_info = file_info_new()
local path = 'unit-test-directory/test.file'
assert.is_true((fs.os_fileinfo(path, file_info)))
@@ -975,7 +976,7 @@ describe('fs function', function()
end)
describe('os_fileinfo_size', function()
- it('returns the correct size of a file', function()
+ itp('returns the correct size of a file', function()
local path = 'unit-test-directory/test.file'
local file = io.open(path, 'w')
file:write('some bytes to get filesize != 0')
@@ -989,7 +990,7 @@ describe('fs function', function()
end)
describe('os_fileinfo_hardlinks', function()
- it('returns the correct number of hardlinks', function()
+ itp('returns the correct number of hardlinks', function()
local path = 'unit-test-directory/test.file'
local path_link = 'unit-test-directory/test_hlink.file'
local file_info = file_info_new()
@@ -1002,7 +1003,7 @@ describe('fs function', function()
end)
describe('os_fileinfo_blocksize', function()
- it('returns the correct blocksize of a file', function()
+ itp('returns the correct blocksize of a file', function()
local path = 'unit-test-directory/test.file'
-- there is a bug in luafilesystem where
-- `lfs.attributes path, 'blksize'` returns the worng value:
@@ -1023,12 +1024,12 @@ describe('fs function', function()
end)
describe('os_fileid', function()
- it('returns false if given an non-existing file', function()
+ itp('returns false if given an non-existing file', function()
local file_id = file_id_new()
assert.is_false((fs.os_fileid('/non-existent', file_id)))
end)
- it('returns true if given an existing file and fills file_id', function()
+ itp('returns true if given an existing file and fills file_id', function()
local file_id = file_id_new()
local path = 'unit-test-directory/test.file'
assert.is_true((fs.os_fileid(path, file_id)))
@@ -1038,14 +1039,14 @@ describe('fs function', function()
end)
describe('os_fileid_equal', function()
- it('returns true if two FileIDs are equal', function()
+ itp('returns true if two FileIDs are equal', function()
local file_id = file_id_new()
local path = 'unit-test-directory/test.file'
assert.is_true((fs.os_fileid(path, file_id)))
assert.is_true((fs.os_fileid_equal(file_id, file_id)))
end)
- it('returns false if two FileIDs are not equal', function()
+ itp('returns false if two FileIDs are not equal', function()
local file_id_1 = file_id_new()
local file_id_2 = file_id_new()
local path_1 = 'unit-test-directory/test.file'
@@ -1057,7 +1058,7 @@ describe('fs function', function()
end)
describe('os_fileid_equal_fileinfo', function()
- it('returns true if file_id and file_info represent the same file', function()
+ itp('returns true if file_id and file_info represent the same file', function()
local file_id = file_id_new()
local file_info = file_info_new()
local path = 'unit-test-directory/test.file'
@@ -1066,7 +1067,7 @@ describe('fs function', function()
assert.is_true((fs.os_fileid_equal_fileinfo(file_id, file_info)))
end)
- it('returns false if file_id and file_info represent different files', function()
+ itp('returns false if file_id and file_info represent different files', function()
local file_id = file_id_new()
local file_info = file_info_new()
local path_1 = 'unit-test-directory/test.file'
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')
diff --git a/test/unit/os/users_spec.lua b/test/unit/os/users_spec.lua
index 236481e9e7..a7ec9ab0bb 100644
--- a/test/unit/os/users_spec.lua
+++ b/test/unit/os/users_spec.lua
@@ -1,4 +1,5 @@
local helpers = require('test.unit.helpers')
+local itp = helpers.gen_itp(it)
local cimport = helpers.cimport
local eq = helpers.eq
@@ -27,11 +28,11 @@ describe('users function', function()
local current_username = os.getenv('USER')
describe('os_get_usernames', function()
- it('returns FAIL if called with NULL', function()
+ itp('returns FAIL if called with NULL', function()
eq(FAIL, users.os_get_usernames(NULL))
end)
- it('fills the names garray with os usernames and returns OK', function()
+ itp('fills the names garray with os usernames and returns OK', function()
local ga_users = garray_new()
eq(OK, users.os_get_usernames(ga_users))
local user_count = garray_get_len(ga_users)
@@ -48,7 +49,7 @@ describe('users function', function()
end)
describe('os_get_user_name', function()
- it('should write the username into the buffer and return OK', function()
+ itp('should write the username into the buffer and return OK', function()
local name_out = ffi.new('char[100]')
eq(OK, users.os_get_user_name(name_out, 100))
eq(current_username, ffi.string(name_out))
@@ -56,14 +57,14 @@ describe('users function', function()
end)
describe('os_get_uname', function()
- it('should write the username into the buffer and return OK', function()
+ itp('should write the username into the buffer and return OK', function()
local name_out = ffi.new('char[100]')
local user_id = lib.getuid()
eq(OK, users.os_get_uname(user_id, name_out, 100))
eq(current_username, ffi.string(name_out))
end)
- it('should FAIL if the userid is not found', function()
+ itp('should FAIL if the userid is not found', function()
local name_out = ffi.new('char[100]')
-- hoping nobody has this uid
local user_id = 2342
@@ -73,16 +74,16 @@ describe('users function', function()
end)
describe('os_get_user_directory', function()
- it('should return NULL if called with NULL', function()
+ itp('should return NULL if called with NULL', function()
eq(NULL, users.os_get_user_directory(NULL))
end)
- it('should return $HOME for the current user', function()
+ itp('should return $HOME for the current user', function()
local home = os.getenv('HOME')
eq(home, ffi.string((users.os_get_user_directory(current_username))))
end)
- it('should return NULL if the user is not found', function()
+ itp('should return NULL if the user is not found', function()
eq(NULL, users.os_get_user_directory('neovim_user_not_found_test'))
end)
end)