mirror of
https://github.com/neovim/neovim.git
synced 2026-07-31 20:59:11 +00:00
test(api): allow added optional params
This commit is contained in:
@@ -93,6 +93,9 @@ describe('api metadata', function()
|
||||
error(('"%s": parameter %d was optional, now required'):format(old_fn.name, idx))
|
||||
end
|
||||
end
|
||||
while #new_fn.parameters > #old_fn.parameters and new_fn.parameters[#new_fn.parameters][3] do
|
||||
table.remove(new_fn.parameters)
|
||||
end
|
||||
old_fn = normalize_func_metadata(old_fn)
|
||||
new_fn = normalize_func_metadata(new_fn)
|
||||
if old_fn.return_type == 'void' then
|
||||
@@ -248,6 +251,22 @@ describe('api metadata', function()
|
||||
)
|
||||
end)
|
||||
|
||||
it('optional param may be added', function()
|
||||
assert_func_backcompat({
|
||||
name = 'nvim_example',
|
||||
method = false,
|
||||
since = 1,
|
||||
return_type = 'void',
|
||||
parameters = { { 'String', 'src', false } },
|
||||
}, {
|
||||
name = 'nvim_example',
|
||||
method = false,
|
||||
since = 1,
|
||||
return_type = 'void',
|
||||
parameters = { { 'String', 'src', false }, { 'Dict', 'opts', true } },
|
||||
})
|
||||
end)
|
||||
|
||||
it('UI events are compatible with old metadata or have new level', function()
|
||||
local ui_events_new = name_table(api_info.ui_events)
|
||||
local ui_events_compat = {}
|
||||
|
||||
Reference in New Issue
Block a user