diff options
author | Stefan Hoffmann <stefan991@gmail.com> | 2014-03-07 13:43:55 +0100 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-03-13 17:18:44 -0300 |
commit | 33eb031c01a0a918283290884db0e72ea2f587f0 (patch) | |
tree | 8d4f391b439fa6feb0d34fd35e1b2566a28bf755 /test/unit | |
parent | ad77ff53d3ad5f1c4fdf2938bab2c9999df2c82b (diff) | |
download | rneovim-33eb031c01a0a918283290884db0e72ea2f587f0.tar.gz rneovim-33eb031c01a0a918283290884db0e72ea2f587f0.tar.bz2 rneovim-33eb031c01a0a918283290884db0e72ea2f587f0.zip |
refactored part of expand_env_esc() into mch_get_user_directory()
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/os/users.moon | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/unit/os/users.moon b/test/unit/os/users.moon index 2f08bdbdf5..76f51c94f2 100644 --- a/test/unit/os/users.moon +++ b/test/unit/os/users.moon @@ -14,6 +14,7 @@ typedef struct growarray { int mch_get_usernames(garray_T *usernames); int mch_get_user_name(char *s, size_t len); int mch_get_uname(int uid, char *s, size_t len); +char *mch_get_user_directory(const char *name); int getuid(void); ]] @@ -75,3 +76,15 @@ describe 'users function', -> eq FAIL, users.mch_get_uname(user_id, name_out, 100) eq '2342', ffi.string name_out + describe 'mch_get_user_directory', -> + + it 'should return NULL if called with NULL', -> + eq NULL, users.mch_get_user_directory NULL + + it 'should return $HOME for the current user', -> + home = os.getenv('HOME') + eq home, ffi.string (users.mch_get_user_directory current_username) + + it 'should return NULL if the user is not found', -> + eq NULL, users.mch_get_user_directory 'neovim_user_not_found_test' + |