aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/eval/executable_spec.lua11
-rw-r--r--test/functional/eval/exepath_spec.lua28
-rwxr-xr-xtest/functional/fixtures/bin/false0
-rwxr-xr-xtest/functional/fixtures/bin/false.cmd0
-rwxr-xr-xtest/functional/fixtures/bin/null0
-rwxr-xr-xtest/functional/fixtures/bin/null.cmd0
-rwxr-xr-xtest/functional/fixtures/bin/true0
-rwxr-xr-xtest/functional/fixtures/bin/true.cmd0
8 files changed, 32 insertions, 7 deletions
diff --git a/test/functional/eval/executable_spec.lua b/test/functional/eval/executable_spec.lua
index a1cf056907..f8e579a8ff 100644
--- a/test/functional/eval/executable_spec.lua
+++ b/test/functional/eval/executable_spec.lua
@@ -2,6 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
local eq, clear, call, iswin, write_file, command =
helpers.eq, helpers.clear, helpers.call, helpers.iswin, helpers.write_file,
helpers.command
+local exc_exec = helpers.exc_exec
local eval = helpers.eval
describe('executable()', function()
@@ -12,6 +13,16 @@ describe('executable()', function()
eq(1, call('executable', exe))
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 executable('..input..')'))
+ end
+ command('let $PATH = fnamemodify("./test/functional/fixtures/bin", ":p")')
+ for _, input in ipairs({'v:null', 'v:true', 'v:false'}) do
+ eq('Vim(call):E928: String required', exc_exec('call executable('..input..')'))
+ end
+ end)
+
it('returns 0 for non-existent files', function()
eq(0, call('executable', 'no_such_file_exists_209ufq23f'))
end)
diff --git a/test/functional/eval/exepath_spec.lua b/test/functional/eval/exepath_spec.lua
index 10a11aeacc..b86fea5535 100644
--- a/test/functional/eval/exepath_spec.lua
+++ b/test/functional/eval/exepath_spec.lua
@@ -1,14 +1,28 @@
local helpers = require('test.functional.helpers')(after_each)
local eq, clear, call, iswin =
helpers.eq, helpers.clear, helpers.call, helpers.iswin
+local command = helpers.command
+local exc_exec = helpers.exc_exec
-describe('exepath() (Windows)', function()
- if not iswin() then return end -- N/A for Unix.
+describe('exepath()', function()
+ before_each(clear)
- it('append extension if omitted', function()
- local filename = 'cmd'
- local pathext = '.exe'
- clear({env={PATHEXT=pathext}})
- eq(call('exepath', filename..pathext), call('exepath', filename))
+ 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..')'))
+ end
+ command('let $PATH = fnamemodify("./test/functional/fixtures/bin", ":p")')
+ for _, input in ipairs({'v:null', 'v:true', 'v:false'}) do
+ eq('Vim(call):E928: String required', exc_exec('call exepath('..input..')'))
+ end
end)
+
+ if iswin() then
+ it('append extension if omitted', function()
+ local filename = 'cmd'
+ local pathext = '.exe'
+ clear({env={PATHEXT=pathext}})
+ eq(call('exepath', filename..pathext), call('exepath', filename))
+ end)
+ end
end)
diff --git a/test/functional/fixtures/bin/false b/test/functional/fixtures/bin/false
new file mode 100755
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/functional/fixtures/bin/false
diff --git a/test/functional/fixtures/bin/false.cmd b/test/functional/fixtures/bin/false.cmd
new file mode 100755
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/functional/fixtures/bin/false.cmd
diff --git a/test/functional/fixtures/bin/null b/test/functional/fixtures/bin/null
new file mode 100755
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/functional/fixtures/bin/null
diff --git a/test/functional/fixtures/bin/null.cmd b/test/functional/fixtures/bin/null.cmd
new file mode 100755
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/functional/fixtures/bin/null.cmd
diff --git a/test/functional/fixtures/bin/true b/test/functional/fixtures/bin/true
new file mode 100755
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/functional/fixtures/bin/true
diff --git a/test/functional/fixtures/bin/true.cmd b/test/functional/fixtures/bin/true.cmd
new file mode 100755
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/functional/fixtures/bin/true.cmd