diff options
Diffstat (limited to 'test/unit/os/users_spec.lua')
-rw-r--r-- | test/unit/os/users_spec.lua | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/test/unit/os/users_spec.lua b/test/unit/os/users_spec.lua index 236481e9e7..f92413c7de 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 helpers = require('test.unit.helpers')(after_each) +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) |