diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-12-11 23:36:15 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-11 23:36:15 -0500 |
commit | cacdef5ff18e7123a9e734537a831839bf4ef0ec (patch) | |
tree | 5d4f1683e7678c1ba339992438def2a16e59adb9 /test/functional/eval/executable_spec.lua | |
parent | 062576f679a1bd5cb546bb8081dc97caefe7b51f (diff) | |
parent | da58242fb8e432415778e3eeab96a9d63edfdf06 (diff) | |
download | rneovim-cacdef5ff18e7123a9e734537a831839bf4ef0ec.tar.gz rneovim-cacdef5ff18e7123a9e734537a831839bf4ef0ec.tar.bz2 rneovim-cacdef5ff18e7123a9e734537a831839bf4ef0ec.zip |
Merge pull request #13489 from janlazo/issue-13485
eval: executable(), exepath() accept strings only
Diffstat (limited to 'test/functional/eval/executable_spec.lua')
-rw-r--r-- | test/functional/eval/executable_spec.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/functional/eval/executable_spec.lua b/test/functional/eval/executable_spec.lua index a1cf056907..28aefb72e5 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() @@ -10,6 +11,20 @@ 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() + 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() |