aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval/exepath_spec.lua
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-12-11 22:59:43 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-12-11 22:59:43 -0500
commitda58242fb8e432415778e3eeab96a9d63edfdf06 (patch)
tree5d4f1683e7678c1ba339992438def2a16e59adb9 /test/functional/eval/exepath_spec.lua
parent5ccc79e880d5913f092e041f1a67530c1d2d6728 (diff)
downloadrneovim-da58242fb8e432415778e3eeab96a9d63edfdf06.tar.gz
rneovim-da58242fb8e432415778e3eeab96a9d63edfdf06.tar.bz2
rneovim-da58242fb8e432415778e3eeab96a9d63edfdf06.zip
test/functional/eval: assert that executable() fixtures are executable
Diffstat (limited to 'test/functional/eval/exepath_spec.lua')
-rw-r--r--test/functional/eval/exepath_spec.lua12
1 files changed, 12 insertions, 0 deletions
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..')'))