aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval/executable_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-02-02 13:16:15 +0100
committerJustin M. Keyes <justinkz@gmail.com>2017-02-04 11:07:49 +0100
commit224f99b85d311ebd31451db13b66e4a3c7e51938 (patch)
treede2bb4bc8f06e09ede603ae535697384133a4ed5 /test/functional/eval/executable_spec.lua
parent7d58aba80c6d81a9af40f54e566c0cdcea2de3e3 (diff)
downloadrneovim-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/functional/eval/executable_spec.lua')
-rw-r--r--test/functional/eval/executable_spec.lua25
1 files changed, 22 insertions, 3 deletions
diff --git a/test/functional/eval/executable_spec.lua b/test/functional/eval/executable_spec.lua
index dd8861a07c..bcf5eba4eb 100644
--- a/test/functional/eval/executable_spec.lua
+++ b/test/functional/eval/executable_spec.lua
@@ -1,7 +1,6 @@
local helpers = require('test.functional.helpers')(after_each)
-local eq, clear, execute, call, iswin, write_file =
- helpers.eq, helpers.clear, helpers.execute, helpers.call, helpers.iswin,
- helpers.write_file
+local eq, clear, call, iswin, write_file =
+ helpers.eq, helpers.clear, helpers.call, helpers.iswin, helpers.write_file
describe('executable()', function()
before_each(clear)
@@ -15,8 +14,28 @@ describe('executable()', function()
eq(0, call('executable', 'no_such_file_exists_209ufq23f'))
end)
+ it('sibling to nvim binary', function()
+ -- Some executable in build/bin/, *not* in $PATH nor CWD.
+ local sibling_exe = 'printargs-test'
+ -- Windows: siblings are in Nvim's "pseudo-$PATH".
+ local expected = iswin() and 1 or 0
+ if iswin() then
+ print('XXXXXXXXXXXXXXXXXXXXXXXXX')
+ print(helpers.eval('$PATH'))
+ print('XXXXXXXXXXXXXXXXXXXXXXXXX')
+ -- $PATH on AppVeyor CI might be oversized, redefine it to a minimal one.
+ clear({env={PATH=[[C:\Windows\system32;C:\Windows]]}})
+ print(helpers.eval('$PATH'))
+ print('XXXXXXXXXXXXXXXXXXXXXXXXX')
+ eq('arg1=lemon;arg2=sky;arg3=tree;',
+ call('system', sibling_exe..' lemon sky tree'))
+ end
+ eq(expected, call('executable', sibling_exe))
+ end)
+
describe('exec-bit', function()
setup(function()
+ clear()
write_file('Xtest_not_executable', 'non-executable file')
write_file('Xtest_executable', 'executable file (exec-bit set)')
if not iswin() then -- N/A for Windows.