diff options
author | Lewis Russell <lewis6991@gmail.com> | 2022-12-19 16:37:45 +0000 |
---|---|---|
committer | Famiu Haque <famiuhaque@proton.me> | 2023-05-21 15:14:01 +0600 |
commit | 1fe1bb084d0099fc4f9bfdc11189485d0f74b75a (patch) | |
tree | ec823587a4c7ea6991330f6db362846e0fb7bc21 /test/functional/plugin | |
parent | e3e6fadfd82861471c32fdcabe00bbef3de84563 (diff) | |
download | rneovim-1fe1bb084d0099fc4f9bfdc11189485d0f74b75a.tar.gz rneovim-1fe1bb084d0099fc4f9bfdc11189485d0f74b75a.tar.bz2 rneovim-1fe1bb084d0099fc4f9bfdc11189485d0f74b75a.zip |
refactor(options): deprecate nvim[_buf|_win]_[gs]et_option
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: famiu <famiuhaque@protonmail.com>
Diffstat (limited to 'test/functional/plugin')
-rw-r--r-- | test/functional/plugin/editorconfig_spec.lua | 3 | ||||
-rw-r--r-- | test/functional/plugin/lsp/incremental_sync_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/plugin/lsp_spec.lua | 20 | ||||
-rw-r--r-- | test/functional/plugin/shada_spec.lua | 30 |
4 files changed, 28 insertions, 27 deletions
diff --git a/test/functional/plugin/editorconfig_spec.lua b/test/functional/plugin/editorconfig_spec.lua index e6a2550aba..4ad9903032 100644 --- a/test/functional/plugin/editorconfig_spec.lua +++ b/test/functional/plugin/editorconfig_spec.lua @@ -3,7 +3,6 @@ local clear = helpers.clear local command = helpers.command local eq = helpers.eq local pathsep = helpers.get_pathsep() -local curbufmeths = helpers.curbufmeths local funcs = helpers.funcs local meths = helpers.meths @@ -13,7 +12,7 @@ local function test_case(name, expected) local filename = testdir .. pathsep .. name command('edit ' .. filename) for opt, val in pairs(expected) do - eq(val, curbufmeths.get_option(opt), name) + eq(val, meths.get_option_value(opt, {buf=0}), name) end end diff --git a/test/functional/plugin/lsp/incremental_sync_spec.lua b/test/functional/plugin/lsp/incremental_sync_spec.lua index 4985da9cd7..1dca464d74 100644 --- a/test/functional/plugin/lsp/incremental_sync_spec.lua +++ b/test/functional/plugin/lsp/incremental_sync_spec.lua @@ -21,7 +21,7 @@ before_each(function () -- ["mac"] = '\r', -- } - -- local line_ending = format_line_ending[vim.api.nvim_buf_get_option(0, 'fileformat')] + -- local line_ending = format_line_ending[vim.api.nvim_get_option_value('fileformat', {buf=0})] function test_register(bufnr, id, offset_encoding, line_ending) diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index 506bc1333b..b906ae265f 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -33,7 +33,9 @@ local test_rpc_server = lsp_helpers.test_rpc_server local function get_buf_option(name, bufnr) bufnr = bufnr or "BUFFER" - return exec_lua(string.format("return vim.api.nvim_buf_get_option(%s, '%s')", bufnr, name)) + return exec_lua( + string.format("return vim.api.nvim_get_option_value('%s', { buf = %s })", name, bufnr) + ) end -- TODO(justinmk): hangs on Windows https://github.com/neovim/neovim/pull/11837 @@ -356,8 +358,8 @@ describe('LSP', function() vim.api.nvim_command('filetype plugin on') BUFFER_1 = vim.api.nvim_create_buf(false, true) BUFFER_2 = vim.api.nvim_create_buf(false, true) - vim.api.nvim_buf_set_option(BUFFER_1, 'filetype', 'man') - vim.api.nvim_buf_set_option(BUFFER_2, 'filetype', 'xml') + vim.api.nvim_set_option_value('filetype', 'man', { buf = BUFFER_1 }) + vim.api.nvim_set_option_value('filetype', 'xml', { buf = BUFFER_2 }) ]] -- Sanity check to ensure that some values are set after setting filetype. @@ -394,9 +396,9 @@ describe('LSP', function() client = _client exec_lua [[ BUFFER = vim.api.nvim_create_buf(false, true) - vim.api.nvim_buf_set_option(BUFFER, 'tagfunc', 'tfu') - vim.api.nvim_buf_set_option(BUFFER, 'omnifunc', 'ofu') - vim.api.nvim_buf_set_option(BUFFER, 'formatexpr', 'fex') + vim.api.nvim_set_option_value('tagfunc', 'tfu', { buf = BUFFER }) + vim.api.nvim_set_option_value('omnifunc', 'ofu', { buf = BUFFER }) + vim.api.nvim_set_option_value('formatexpr', 'fex', { buf = BUFFER }) lsp.buf_attach_client(BUFFER, TEST_RPC_CLIENT_ID) ]] end; @@ -1166,7 +1168,7 @@ describe('LSP', function() "testing"; "123"; }) - vim.api.nvim_buf_set_option(BUFFER, 'eol', false) + vim.bo[BUFFER].eol = false ]] end; on_init = function(_client) @@ -2929,8 +2931,8 @@ describe('LSP', function() describe('lsp.util.get_effective_tabstop', function() local function test_tabstop(tabsize, shiftwidth) exec_lua(string.format([[ - vim.api.nvim_buf_set_option(0, 'shiftwidth', %d) - vim.api.nvim_buf_set_option(0, 'tabstop', 2) + vim.bo.shiftwidth = %d + vim.bo.tabstop = 2 ]], shiftwidth)) eq(tabsize, exec_lua('return vim.lsp.util.get_effective_tabstop()')) end diff --git a/test/functional/plugin/shada_spec.lua b/test/functional/plugin/shada_spec.lua index f6145a5809..43222f1904 100644 --- a/test/functional/plugin/shada_spec.lua +++ b/test/functional/plugin/shada_spec.lua @@ -2181,8 +2181,8 @@ describe('plugin/shada.vim', function() ' - contents "ab"', ' - "a"', }, nvim_eval('getline(1, "$")')) - eq(false, curbuf('get_option', 'modified')) - eq('shada', curbuf('get_option', 'filetype')) + eq(false, nvim('get_option_value', 'modified', {buf=0})) + eq('shada', nvim('get_option_value', 'filetype', {buf=0})) nvim_command('edit ' .. fname_tmp) eq({ 'History entry with timestamp ' .. epoch .. ':', @@ -2191,8 +2191,8 @@ describe('plugin/shada.vim', function() ' - contents "ab"', ' - "b"', }, nvim_eval('getline(1, "$")')) - eq(false, curbuf('get_option', 'modified')) - eq('shada', curbuf('get_option', 'filetype')) + eq(false, nvim('get_option_value', 'modified', {buf=0})) + eq('shada', nvim('get_option_value', 'filetype', {buf=0})) eq('++opt not supported', exc_exec('edit ++enc=latin1 ' .. fname)) neq({ 'History entry with timestamp ' .. epoch .. ':', @@ -2201,7 +2201,7 @@ describe('plugin/shada.vim', function() ' - contents "ab"', ' - "a"', }, nvim_eval('getline(1, "$")')) - neq(true, curbuf('get_option', 'modified')) + neq(true, nvim('get_option_value', 'modified', {buf=0})) end) it('event FileReadCmd', function() @@ -2217,8 +2217,8 @@ describe('plugin/shada.vim', function() ' - contents "ab"', ' - "a"', }, nvim_eval('getline(1, "$")')) - eq(true, curbuf('get_option', 'modified')) - neq('shada', curbuf('get_option', 'filetype')) + eq(true, nvim('get_option_value', 'modified', {buf=0})) + neq('shada', nvim('get_option_value', 'filetype', {buf=0})) nvim_command('1,$read ' .. fname_tmp) eq({ '', @@ -2233,9 +2233,9 @@ describe('plugin/shada.vim', function() ' - contents "ab"', ' - "b"', }, nvim_eval('getline(1, "$")')) - eq(true, curbuf('get_option', 'modified')) - neq('shada', curbuf('get_option', 'filetype')) - curbuf('set_option', 'modified', false) + eq(true, nvim('get_option_value', 'modified', {buf=0})) + neq('shada', nvim('get_option_value', 'filetype', {buf=0})) + nvim('set_option_value', 'modified', false, {buf=0}) eq('++opt not supported', exc_exec('$read ++enc=latin1 ' .. fname)) eq({ '', @@ -2250,7 +2250,7 @@ describe('plugin/shada.vim', function() ' - contents "ab"', ' - "b"', }, nvim_eval('getline(1, "$")')) - neq(true, curbuf('get_option', 'modified')) + neq(true, nvim('get_option_value', 'modified', {buf=0})) end) it('event BufWriteCmd', function() @@ -2517,10 +2517,10 @@ describe('ftplugin/shada.vim', function() it('sets options correctly', function() nvim_command('filetype plugin indent on') nvim_command('setlocal filetype=shada') - eq(true, curbuf('get_option', 'expandtab')) - eq(2, curbuf('get_option', 'tabstop')) - eq(2, curbuf('get_option', 'softtabstop')) - eq(2, curbuf('get_option', 'shiftwidth')) + eq(true, nvim('get_option_value', 'expandtab', {buf=0})) + eq(2, nvim('get_option_value', 'tabstop', {buf=0})) + eq(2, nvim('get_option_value', 'softtabstop', {buf=0})) + eq(2, nvim('get_option_value', 'shiftwidth', {buf=0})) end) it('sets indentkeys correctly', function() |