diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2024-09-23 07:14:10 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-23 07:14:10 -0700 |
| commit | 34a40d3a50f71a4b5e06c36ed9f9110983984dbf (patch) | |
| tree | 69f647ce5f5dba8f16cb2a55a2511b89df4db87e /test/functional/api | |
| parent | 47e6b2233feffc6e9d94f6086fb904eb5688fa25 (diff) | |
| parent | 17027d64726864c7bbdba5bee004eb581ac4b54a (diff) | |
| download | rneovim-34a40d3a50f71a4b5e06c36ed9f9110983984dbf.tar.gz rneovim-34a40d3a50f71a4b5e06c36ed9f9110983984dbf.tar.bz2 rneovim-34a40d3a50f71a4b5e06c36ed9f9110983984dbf.zip | |
Merge #30435 refactor: rename "Dictionary" => "Dict"
Diffstat (limited to 'test/functional/api')
| -rw-r--r-- | test/functional/api/version_spec.lua | 14 | ||||
| -rw-r--r-- | test/functional/api/vim_spec.lua | 8 |
2 files changed, 15 insertions, 7 deletions
diff --git a/test/functional/api/version_spec.lua b/test/functional/api/version_spec.lua index 5dad9978b7..617786eb2d 100644 --- a/test/functional/api/version_spec.lua +++ b/test/functional/api/version_spec.lua @@ -58,10 +58,18 @@ describe('api metadata', function() return by_name end - -- Remove metadata that is not essential to backwards-compatibility. - local function filter_function_metadata(f) + -- Remove or patch metadata that is not essential to backwards-compatibility. + local function normalize_func_metadata(f) + -- Dictionary was renamed to Dict. That doesn't break back-compat because clients don't actually + -- use the `return_type` field (evidence: "ArrayOf(…)" didn't break clients). + f.return_type = f.return_type:gsub('Dictionary', 'Dict') + f.deprecated_since = nil for idx, _ in ipairs(f.parameters) do + -- Dictionary was renamed to Dict. Doesn't break back-compat because clients don't actually + -- use the `parameters` field of API metadata (evidence: "ArrayOf(…)" didn't break clients). + f.parameters[idx][1] = f.parameters[idx][1]:gsub('Dictionary', 'Dict') + f.parameters[idx][2] = '' -- Remove parameter name. end @@ -141,7 +149,7 @@ describe('api metadata', function() ) end else - eq(filter_function_metadata(f), filter_function_metadata(funcs_new[f.name])) + eq(normalize_func_metadata(f), normalize_func_metadata(funcs_new[f.name])) end end funcs_compat[level] = name_table(old_api[level].functions) diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index ea6b70f4d7..b35ccb0c40 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -693,7 +693,7 @@ describe('API', function() pcall_err(request, 'nvim_call_dict_function', "{ 'f': '' }", 'f', { 1, 2 }) ) eq( - 'dict argument type must be String or Dictionary', + 'dict argument type must be String or Dict', pcall_err(request, 'nvim_call_dict_function', 42, 'f', { 1, 2 }) ) eq( @@ -1573,7 +1573,7 @@ describe('API', function() it('nvim_get_vvar, nvim_set_vvar', function() eq('Key is read-only: count', pcall_err(request, 'nvim_set_vvar', 'count', 42)) - eq('Dictionary is locked', pcall_err(request, 'nvim_set_vvar', 'nosuchvar', 42)) + eq('Dict is locked', pcall_err(request, 'nvim_set_vvar', 'nosuchvar', 42)) api.nvim_set_vvar('errmsg', 'set by API') eq('set by API', api.nvim_get_vvar('errmsg')) api.nvim_set_vvar('completed_item', { word = 'a', user_data = vim.empty_dict() }) @@ -2212,7 +2212,7 @@ describe('API', function() end) describe('nvim_load_context', function() - it('sets current editor state to given context dictionary', function() + it('sets current editor state to given context dict', function() local opts = { types = { 'regs', 'jumps', 'bufs', 'gvars' } } eq({}, parse_context(api.nvim_get_context(opts))) @@ -2228,7 +2228,7 @@ describe('API', function() eq({ 1, 2, 3 }, eval('[g:one, g:Two, g:THREE]')) end) - it('errors when context dictionary is invalid', function() + it('errors when context dict is invalid', function() eq( 'E474: Failed to convert list to msgpack string buffer', pcall_err(api.nvim_load_context, { regs = { {} }, jumps = { {} } }) |