diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-02-02 13:16:15 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-02-04 11:07:49 +0100 |
commit | 224f99b85d311ebd31451db13b66e4a3c7e51938 (patch) | |
tree | de2bb4bc8f06e09ede603ae535697384133a4ed5 /test/unit/os/env_spec.lua | |
parent | 7d58aba80c6d81a9af40f54e566c0cdcea2de3e3 (diff) | |
download | rneovim-224f99b85d311ebd31451db13b66e4a3c7e51938.tar.gz rneovim-224f99b85d311ebd31451db13b66e4a3c7e51938.tar.bz2 rneovim-224f99b85d311ebd31451db13b66e4a3c7e51938.zip |
win: Append process dir to $PATH
This allows executables to be found by :!, system(), and executable() if
they live next to ("sibling" to) nvim.exe. This is what gvim on Windows
does, and also matches the behavior of Win32 SearchPath().
https://github.com/vim/vim/blob/c4a249a736d40ec54794827ef95804c225d0e38f/src/os_win32.c#L354-L370
Diffstat (limited to 'test/unit/os/env_spec.lua')
-rw-r--r-- | test/unit/os/env_spec.lua | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/test/unit/os/env_spec.lua b/test/unit/os/env_spec.lua index 64bbaaa8c2..3c2cc164c9 100644 --- a/test/unit/os/env_spec.lua +++ b/test/unit/os/env_spec.lua @@ -14,15 +14,15 @@ local cimp = cimport('./src/nvim/os/os.h') describe('env function', function() local function os_setenv(name, value, override) - return cimp.os_setenv((to_cstr(name)), (to_cstr(value)), override) + return cimp.os_setenv(to_cstr(name), to_cstr(value), override) end local function os_unsetenv(name, _, _) - return cimp.os_unsetenv((to_cstr(name))) + return cimp.os_unsetenv(to_cstr(name)) end local function os_getenv(name) - local rval = cimp.os_getenv((to_cstr(name))) + local rval = cimp.os_getenv(to_cstr(name)) if rval ~= NULL then return ffi.string(rval) else @@ -52,6 +52,20 @@ describe('env function', function() end) end) + describe('os_setenv_append_path', function() + it('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() + local original_path = os.getenv('PATH') + eq(false, cimp.os_setenv_append_path(to_cstr('foo/bar/baz'))) + eq(original_path, os.getenv('PATH')) + end) + end) + describe('os_getenv', function() it('reads an env variable', function() local name = 'NEOVIM_UNIT_TEST_GETENV_1N' |