test: fix vim.deprecate tests

This commit is contained in:
Lewis Russell
2024-06-12 15:47:42 +01:00
parent 8bf79bd13c
commit 2ca678f57d

View File

@@ -135,14 +135,15 @@ describe('lua stdlib', function()
-- See MAINTAIN.md for the soft/hard deprecation policy -- See MAINTAIN.md for the soft/hard deprecation policy
describe(('vim.deprecate prerel=%s,'):format(prerel or 'nil'), function() describe(('vim.deprecate prerel=%s,'):format(prerel or 'nil'), function()
local curver = exec_lua('return vim.version()') --[[@as {major:number, minor:number}]] local curver --- @type {major:number, minor:number}
-- "0.10" or "0.10-dev+xxx"
local curstr = ('%s.%s%s'):format(curver.major, curver.minor, prerel or '') before_each(function()
-- "0.10" or "0.11" curver = exec_lua('return vim.version()')
local nextver = ('%s.%s'):format(curver.major, curver.minor + (prerel and 0 or 1)) end)
local was_removed = prerel and 'was removed' or 'will be removed'
it('plugin=nil, same message skipped', function() it('plugin=nil, same message skipped', function()
-- "0.10" or "0.10-dev+xxx"
local curstr = ('%s.%s%s'):format(curver.major, curver.minor, prerel or '')
eq( eq(
dedent( dedent(
[[ [[
@@ -162,6 +163,10 @@ describe('lua stdlib', function()
end) end)
it('plugin=nil, show error if hard-deprecated', function() it('plugin=nil, show error if hard-deprecated', function()
-- "0.10" or "0.11"
local nextver = ('%s.%s'):format(curver.major, curver.minor + (prerel and 0 or 1))
local was_removed = prerel and 'was removed' or 'will be removed'
eq( eq(
dedent( dedent(
[[ [[
@@ -2024,15 +2029,9 @@ describe('lua stdlib', function()
]] ]]
eq(100, fn.luaeval 'vim.wo.scrolloff') eq(100, fn.luaeval 'vim.wo.scrolloff')
matches( matches('only bufnr=0 is supported', pcall_err(exec_lua, 'vim.wo[0][10].signcolumn = "no"'))
'only bufnr=0 is supported',
pcall_err(exec_lua, 'vim.wo[0][10].signcolumn = "no"')
)
matches( matches('only bufnr=0 is supported', pcall_err(exec_lua, 'local a = vim.wo[0][10].signcolumn'))
'only bufnr=0 is supported',
pcall_err(exec_lua, 'local a = vim.wo[0][10].signcolumn')
)
end) end)
describe('vim.opt', function() describe('vim.opt', function()