aboutsummaryrefslogtreecommitdiff
path: root/test/unit/os/users_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/users_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/users_spec.lua')
-rw-r--r--test/unit/os/users_spec.lua17
1 files changed, 9 insertions, 8 deletions
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)