aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/functional/eval/executable_spec.lua4
-rw-r--r--test/functional/eval/exepath_spec.lua12
2 files changed, 16 insertions, 0 deletions
diff --git a/test/functional/eval/executable_spec.lua b/test/functional/eval/executable_spec.lua
index f8e579a8ff..28aefb72e5 100644
--- a/test/functional/eval/executable_spec.lua
+++ b/test/functional/eval/executable_spec.lua
@@ -11,6 +11,10 @@ describe('executable()', function()
it('returns 1 for commands in $PATH', function()
local exe = iswin() and 'ping' or 'ls'
eq(1, call('executable', exe))
+ command('let $PATH = fnamemodify("./test/functional/fixtures/bin", ":p")')
+ eq(1, call('executable', 'null'))
+ eq(1, call('executable', 'true'))
+ eq(1, call('executable', 'false'))
end)
it('fails for invalid values', function()
diff --git a/test/functional/eval/exepath_spec.lua b/test/functional/eval/exepath_spec.lua
index b86fea5535..08d2c59af8 100644
--- a/test/functional/eval/exepath_spec.lua
+++ b/test/functional/eval/exepath_spec.lua
@@ -3,10 +3,22 @@ local eq, clear, call, iswin =
helpers.eq, helpers.clear, helpers.call, helpers.iswin
local command = helpers.command
local exc_exec = helpers.exc_exec
+local matches = helpers.matches
describe('exepath()', function()
before_each(clear)
+ it('returns 1 for commands in $PATH', function()
+ local exe = iswin() and 'ping' or 'ls'
+ local ext_pat = iswin() and '%.EXE$' or '$'
+ matches(exe .. ext_pat, call('exepath', exe))
+ command('let $PATH = fnamemodify("./test/functional/fixtures/bin", ":p")')
+ ext_pat = iswin() and '%.CMD$' or '$'
+ matches('null' .. ext_pat, call('exepath', 'null'))
+ matches('true' .. ext_pat, call('exepath', 'true'))
+ matches('false' .. ext_pat, call('exepath', 'false'))
+ end)
+
it('fails for invalid values', function()
for _, input in ipairs({'""', 'v:null', 'v:true', 'v:false', '{}', '[]'}) do
eq('Vim(call):E928: String required', exc_exec('call exepath('..input..')'))