mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 03:48:18 +00:00
functests: Replace check_provider -> missing_provider with err report
This commit is contained in:
@@ -7,7 +7,7 @@ local clear = helpers.clear
|
|||||||
local dedent = helpers.dedent
|
local dedent = helpers.dedent
|
||||||
local source = helpers.source
|
local source = helpers.source
|
||||||
local exc_exec = helpers.exc_exec
|
local exc_exec = helpers.exc_exec
|
||||||
local check_provider = helpers.check_provider
|
local missing_provider = helpers.missing_provider
|
||||||
|
|
||||||
before_each(clear)
|
before_each(clear)
|
||||||
|
|
||||||
@@ -61,9 +61,9 @@ describe('script_get-based command', function()
|
|||||||
test_garbage_exec('lua', true)
|
test_garbage_exec('lua', true)
|
||||||
|
|
||||||
-- Provider-based scripts
|
-- Provider-based scripts
|
||||||
test_garbage_exec('ruby', check_provider('ruby'))
|
test_garbage_exec('ruby', not missing_provider('ruby'))
|
||||||
test_garbage_exec('python', check_provider('python'))
|
test_garbage_exec('python', not missing_provider('python'))
|
||||||
test_garbage_exec('python3', check_provider('python3'))
|
test_garbage_exec('python3', not missing_provider('python3'))
|
||||||
|
|
||||||
-- Missing scripts
|
-- Missing scripts
|
||||||
test_garbage_exec('tcl', false)
|
test_garbage_exec('tcl', false)
|
||||||
|
@@ -566,14 +566,14 @@ local function get_pathsep()
|
|||||||
return funcs.fnamemodify('.', ':p'):sub(-1)
|
return funcs.fnamemodify('.', ':p'):sub(-1)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function check_provider(provider)
|
local function missing_provider(provider)
|
||||||
if provider == 'ruby' then
|
if provider == 'ruby' then
|
||||||
local prog = funcs['provider#' .. provider .. '#Detect']()
|
local prog = funcs['provider#' .. provider .. '#Detect']()
|
||||||
return prog ~= ''
|
return prog == '' and (provider .. ' not detected') or false
|
||||||
elseif provider == 'python' or provider == 'python3' then
|
elseif provider == 'python' or provider == 'python3' then
|
||||||
local py_major_version = (provider == 'python3' and 3 or 2)
|
local py_major_version = (provider == 'python3' and 3 or 2)
|
||||||
local errors = funcs['provider#pythonx#Detect'](py_major_version)[2]
|
local errors = funcs['provider#pythonx#Detect'](py_major_version)[2]
|
||||||
return errors == ''
|
return errors ~= '' and errors or false
|
||||||
else
|
else
|
||||||
assert(false, 'Unknown provider: ' .. provider)
|
assert(false, 'Unknown provider: ' .. provider)
|
||||||
end
|
end
|
||||||
@@ -645,7 +645,7 @@ local module = {
|
|||||||
meth_pcall = meth_pcall,
|
meth_pcall = meth_pcall,
|
||||||
NIL = mpack.NIL,
|
NIL = mpack.NIL,
|
||||||
get_pathsep = get_pathsep,
|
get_pathsep = get_pathsep,
|
||||||
check_provider = check_provider,
|
missing_provider = missing_provider,
|
||||||
}
|
}
|
||||||
|
|
||||||
return function(after_each)
|
return function(after_each)
|
||||||
|
@@ -3,13 +3,14 @@ local eval, command, feed = helpers.eval, helpers.command, helpers.feed
|
|||||||
local eq, clear, insert = helpers.eq, helpers.clear, helpers.insert
|
local eq, clear, insert = helpers.eq, helpers.clear, helpers.insert
|
||||||
local expect, write_file = helpers.expect, helpers.write_file
|
local expect, write_file = helpers.expect, helpers.write_file
|
||||||
local feed_command = helpers.feed_command
|
local feed_command = helpers.feed_command
|
||||||
local check_provider = helpers.check_provider
|
local missing_provider = helpers.missing_provider
|
||||||
|
|
||||||
do
|
do
|
||||||
clear()
|
clear()
|
||||||
if not check_provider('python3') then
|
local err = missing_provider('python3')
|
||||||
|
if err then
|
||||||
pending(
|
pending(
|
||||||
'Python 3 (or the Python 3 neovim module) is broken or missing:\n' .. errors,
|
'Python 3 (or the Python 3 neovim module) is broken or missing:\n' .. err,
|
||||||
function() end)
|
function() end)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@@ -12,13 +12,14 @@ local command = helpers.command
|
|||||||
local exc_exec = helpers.exc_exec
|
local exc_exec = helpers.exc_exec
|
||||||
local write_file = helpers.write_file
|
local write_file = helpers.write_file
|
||||||
local curbufmeths = helpers.curbufmeths
|
local curbufmeths = helpers.curbufmeths
|
||||||
local check_provider = helpers.check_provider
|
local missing_provider = helpers.missing_provider
|
||||||
|
|
||||||
do
|
do
|
||||||
clear()
|
clear()
|
||||||
if not check_provider('python') then
|
local err = missing_provider('python')
|
||||||
|
if err then
|
||||||
pending(
|
pending(
|
||||||
'Python 2 (or the Python 2 neovim module) is broken or missing:\n' .. errors,
|
'Python 2 (or the Python 2 neovim module) is broken or missing:\n' .. err,
|
||||||
function() end)
|
function() end)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@@ -10,11 +10,11 @@ local expect = helpers.expect
|
|||||||
local command = helpers.command
|
local command = helpers.command
|
||||||
local write_file = helpers.write_file
|
local write_file = helpers.write_file
|
||||||
local curbufmeths = helpers.curbufmeths
|
local curbufmeths = helpers.curbufmeths
|
||||||
local check_provider = helpers.check_provider
|
local missing_provider = helpers.missing_provider
|
||||||
|
|
||||||
do
|
do
|
||||||
clear()
|
clear()
|
||||||
if not check_provider('ruby') then
|
if missing_provider('ruby') then
|
||||||
pending(
|
pending(
|
||||||
"Cannot find the neovim RubyGem. Try :CheckHealth",
|
"Cannot find the neovim RubyGem. Try :CheckHealth",
|
||||||
function() end)
|
function() end)
|
||||||
|
Reference in New Issue
Block a user