neovim/test/functional/provider/provider_spec.lua
dundargoc 052498ed42 test: improve test conventions
Specifically, functions that are run in the context of the test runner
are put in module `test/testutil.lua` while the functions that are run
in the context of the test session are put in
`test/functional/testnvim.lua`.

Closes https://github.com/neovim/neovim/issues/27004.
2024-04-23 18:17:04 +02:00

33 lines
979 B
Lua

local t = require('test.testutil')
local n = require('test.functional.testnvim')()
local clear, eval = n.clear, n.eval
local command = n.command
local eq = t.eq
local pcall_err = t.pcall_err
describe('providers', function()
before_each(function()
clear('--cmd', 'set rtp^=test/functional/fixtures')
end)
it('with #Call(), missing g:loaded_xx_provider', function()
command('set loadplugins')
-- Using test-fixture with broken impl:
-- test/functional/fixtures/autoload/provider/python.vim
eq(
'Vim:provider: python3: missing required variable g:loaded_python3_provider',
pcall_err(eval, "has('python3')")
)
end)
it('with g:loaded_xx_provider, missing #Call()', function()
-- Using test-fixture with broken impl:
-- test/functional/fixtures/autoload/provider/ruby.vim
eq(
'Vim:provider: ruby: g:loaded_ruby_provider=2 but provider#ruby#Call is not defined',
pcall_err(eval, "has('ruby')")
)
end)
end)