diff options
author | Lewis Russell <lewis6991@gmail.com> | 2024-01-12 19:40:58 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-12 19:40:58 +0000 |
commit | 07a7c0ec999102f223a6aca17e93d33e18c02b94 (patch) | |
tree | 221ea513b45596f8e63035955494167fc20bf826 /test/functional/options | |
parent | 7f249936a989dbc21ad03e394197afc07cb9c0bf (diff) | |
parent | 795f896a5772d5e0795f86642bdf90c82efac45c (diff) | |
download | rneovim-07a7c0ec999102f223a6aca17e93d33e18c02b94.tar.gz rneovim-07a7c0ec999102f223a6aca17e93d33e18c02b94.tar.bz2 rneovim-07a7c0ec999102f223a6aca17e93d33e18c02b94.zip |
Merge pull request #26994 from lewis6991/vimhelpers
test: big cleanup
Diffstat (limited to 'test/functional/options')
-rw-r--r-- | test/functional/options/autochdir_spec.lua | 21 | ||||
-rw-r--r-- | test/functional/options/chars_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/options/defaults_spec.lua | 190 | ||||
-rw-r--r-- | test/functional/options/num_options_spec.lua | 26 |
4 files changed, 120 insertions, 121 deletions
diff --git a/test/functional/options/autochdir_spec.lua b/test/functional/options/autochdir_spec.lua index 392c02b07e..11f71912a9 100644 --- a/test/functional/options/autochdir_spec.lua +++ b/test/functional/options/autochdir_spec.lua @@ -1,8 +1,7 @@ -local luv = require('luv') local helpers = require('test.functional.helpers')(after_each) local clear = helpers.clear local eq = helpers.eq -local funcs = helpers.funcs +local fn = helpers.fn local command = helpers.command local mkdir = helpers.mkdir @@ -12,16 +11,16 @@ describe("'autochdir'", function() -- By default 'autochdir' is off, thus getcwd() returns the repo root. clear(targetdir .. '/tty-test.c') - local rootdir = funcs.getcwd() + local rootdir = fn.getcwd() local expected = rootdir .. '/' .. targetdir -- With 'autochdir' on, we should get the directory of tty-test.c. clear('--cmd', 'set autochdir', targetdir .. '/tty-test.c') - eq(helpers.is_os('win') and expected:gsub('/', '\\') or expected, funcs.getcwd()) + eq(helpers.is_os('win') and expected:gsub('/', '\\') or expected, fn.getcwd()) end) it('is not overwritten by getwinvar() call #17609', function() - local curdir = string.gsub(luv.cwd(), '\\', '/') + local curdir = vim.uv.cwd():gsub('\\', '/') local dir_a = curdir .. '/Xtest-functional-options-autochdir.dir_a' local dir_b = curdir .. '/Xtest-functional-options-autochdir.dir_b' mkdir(dir_a) @@ -30,15 +29,15 @@ describe("'autochdir'", function() command('set shellslash') command('set autochdir') command('edit ' .. dir_a .. '/file1') - eq(dir_a, funcs.getcwd()) + eq(dir_a, fn.getcwd()) command('lcd ' .. dir_b) - eq(dir_b, funcs.getcwd()) + eq(dir_b, fn.getcwd()) command('botright vnew ../file2') - eq(curdir, funcs.getcwd()) + eq(curdir, fn.getcwd()) command('wincmd w') - eq(dir_a, funcs.getcwd()) - funcs.getwinvar(2, 'foo') - eq(dir_a, funcs.getcwd()) + eq(dir_a, fn.getcwd()) + fn.getwinvar(2, 'foo') + eq(dir_a, fn.getcwd()) helpers.rmdir(dir_a) helpers.rmdir(dir_b) end) diff --git a/test/functional/options/chars_spec.lua b/test/functional/options/chars_spec.lua index d23dc2ed88..64de25112a 100644 --- a/test/functional/options/chars_spec.lua +++ b/test/functional/options/chars_spec.lua @@ -6,7 +6,7 @@ local eq = helpers.eq local exc_exec = helpers.exc_exec local insert = helpers.insert local feed = helpers.feed -local meths = helpers.meths +local api = helpers.api describe("'fillchars'", function() local screen @@ -203,7 +203,7 @@ describe("'listchars'", function() | ]]) - meths._invalidate_glyph_cache() + api.nvim__invalidate_glyph_cache() screen:_reset() screen:expect([[ {1:d̞̄̃̒̉̎ò́̌̌̂̐ò́̌̌̂̐ò́̌̌̂̐ò́̌̌̂̐ò́̌̌̂̐ò́̌̌̂̐l̞̀̄̆̌̚d̞̄̃̒̉̎ò́̌̌̂̐ò́̌̌̂̐ò́̌̌̂̐ò́̌̌̂̐ò́̌̌̂̐ò́̌̌̂̐l̞̀̄̆̌̚d̞̄̃̒̉̎ò́̌̌̂̐ò́̌̌̂̐ò́̌̌̂̐ò́̌̌̂̐ò́̌̌̂̐ò́̌̌̂̐l̞̀̄̆̌̚}^x{1:å̲} | diff --git a/test/functional/options/defaults_spec.lua b/test/functional/options/defaults_spec.lua index 1d5f657542..10a0baa30b 100644 --- a/test/functional/options/defaults_spec.lua +++ b/test/functional/options/defaults_spec.lua @@ -4,7 +4,7 @@ local Screen = require('test.functional.ui.screen') local assert_alive = helpers.assert_alive local assert_log = helpers.assert_log -local meths = helpers.meths +local api = helpers.api local command = helpers.command local clear = helpers.clear local exc_exec = helpers.exc_exec @@ -12,13 +12,13 @@ local exec_lua = helpers.exec_lua local eval = helpers.eval local eq = helpers.eq local ok = helpers.ok -local funcs = helpers.funcs +local fn = helpers.fn local insert = helpers.insert local neq = helpers.neq local mkdir = helpers.mkdir local rmdir = helpers.rmdir local alter_slashes = helpers.alter_slashes -local tbl_contains = helpers.tbl_contains +local tbl_contains = vim.tbl_contains local expect_exit = helpers.expect_exit local is_os = helpers.is_os @@ -149,7 +149,7 @@ describe('startup defaults', function() ]]) -- change "vert" character to single-cell - funcs.setcellwidths({ { 0x2502, 0x2502, 1 } }) + fn.setcellwidths({ { 0x2502, 0x2502, 1 } }) screen:expect([[ 1 │1 | ^+-- 2 lines: 2----------│+-- 2 lines: 2---------| @@ -159,7 +159,7 @@ describe('startup defaults', function() ]]) -- change "vert" character to double-cell - funcs.setcellwidths({ { 0x2502, 0x2502, 2 } }) + fn.setcellwidths({ { 0x2502, 0x2502, 2 } }) screen:expect([[ 1 |1 | ^+-- 2 lines: 2----------|+-- 2 lines: 2---------| @@ -195,8 +195,8 @@ describe('startup defaults', function() clear { args = {}, args_rm = { '-i' }, env = env } -- Default 'shadafile' is empty. -- This means use the default location. :help shada-file-name - eq('', meths.get_option_value('shadafile', {})) - eq('', meths.get_option_value('viminfofile', {})) + eq('', api.nvim_get_option_value('shadafile', {})) + eq('', api.nvim_get_option_value('viminfofile', {})) -- Handles viminfo/viminfofile as alias for shada/shadafile. eq('\n shadafile=', eval('execute("set shadafile?")')) eq('\n shadafile=', eval('execute("set viminfofile?")')) @@ -218,13 +218,13 @@ describe('startup defaults', function() args_rm = { 'runtimepath' }, } -- Defaults to &runtimepath. - eq(meths.get_option_value('runtimepath', {}), meths.get_option_value('packpath', {})) + eq(api.nvim_get_option_value('runtimepath', {}), api.nvim_get_option_value('packpath', {})) -- Does not follow modifications to runtimepath. - meths.command('set runtimepath+=foo') - neq(meths.get_option_value('runtimepath', {}), meths.get_option_value('packpath', {})) - meths.command('set packpath+=foo') - eq(meths.get_option_value('runtimepath', {}), meths.get_option_value('packpath', {})) + command('set runtimepath+=foo') + neq(api.nvim_get_option_value('runtimepath', {}), api.nvim_get_option_value('packpath', {})) + command('set packpath+=foo') + eq(api.nvim_get_option_value('runtimepath', {}), api.nvim_get_option_value('packpath', {})) end) it('v:progpath is set to the absolute path', function() @@ -316,11 +316,11 @@ describe('XDG defaults', function() }, }) - eq('.', meths.get_option_value('backupdir', {})) - eq('.', meths.get_option_value('viewdir', {})) - eq('.', meths.get_option_value('directory', {})) - eq('.', meths.get_option_value('undodir', {})) - ok((funcs.tempname()):len() > 4) + eq('.', api.nvim_get_option_value('backupdir', {})) + eq('.', api.nvim_get_option_value('viewdir', {})) + eq('.', api.nvim_get_option_value('directory', {})) + eq('.', api.nvim_get_option_value('undodir', {})) + ok((fn.tempname()):len() > 4) end) end) @@ -328,7 +328,7 @@ describe('XDG defaults', function() local vimruntime = eval('$VIMRUNTIME') -- libdir is hard to calculate reliably across various ci platforms -- local libdir = string.gsub(vimruntime, "share/nvim/runtime$", "lib/nvim") - local libdir = meths._get_lib_dir() + local libdir = api.nvim__get_lib_dir() return vimruntime, libdir end @@ -428,13 +428,13 @@ describe('XDG defaults', function() .. '/nvim/after' ):gsub('\\', '/') ), - (meths.get_option_value('runtimepath', {})):gsub('\\', '/') + (api.nvim_get_option_value('runtimepath', {})):gsub('\\', '/') ) - meths.command('set runtimepath&') - meths.command('set backupdir&') - meths.command('set directory&') - meths.command('set undodir&') - meths.command('set viewdir&') + command('set runtimepath&') + command('set backupdir&') + command('set directory&') + command('set undodir&') + command('set viewdir&') eq( ( ( @@ -499,23 +499,23 @@ describe('XDG defaults', function() .. '/nvim/after' ):gsub('\\', '/') ), - (meths.get_option_value('runtimepath', {})):gsub('\\', '/') + (api.nvim_get_option_value('runtimepath', {})):gsub('\\', '/') ) eq( '.,' .. root_path .. ('/X'):rep(4096) .. '/' .. state_dir .. '/backup//', - (meths.get_option_value('backupdir', {}):gsub('\\', '/')) + (api.nvim_get_option_value('backupdir', {}):gsub('\\', '/')) ) eq( root_path .. ('/X'):rep(4096) .. '/' .. state_dir .. '/swap//', - (meths.get_option_value('directory', {})):gsub('\\', '/') + (api.nvim_get_option_value('directory', {})):gsub('\\', '/') ) eq( root_path .. ('/X'):rep(4096) .. '/' .. state_dir .. '/undo//', - (meths.get_option_value('undodir', {})):gsub('\\', '/') + (api.nvim_get_option_value('undodir', {})):gsub('\\', '/') ) eq( root_path .. ('/X'):rep(4096) .. '/' .. state_dir .. '/view//', - (meths.get_option_value('viewdir', {})):gsub('\\', '/') + (api.nvim_get_option_value('viewdir', {})):gsub('\\', '/') ) end) end) @@ -571,13 +571,13 @@ describe('XDG defaults', function() .. ',$XDG_DATA_HOME/nvim/after' ):gsub('\\', '/') ), - (meths.get_option_value('runtimepath', {})):gsub('\\', '/') + (api.nvim_get_option_value('runtimepath', {})):gsub('\\', '/') ) - meths.command('set runtimepath&') - meths.command('set backupdir&') - meths.command('set directory&') - meths.command('set undodir&') - meths.command('set viewdir&') + command('set runtimepath&') + command('set backupdir&') + command('set directory&') + command('set undodir&') + command('set viewdir&') eq( ( ( @@ -599,25 +599,25 @@ describe('XDG defaults', function() .. ',$XDG_DATA_HOME/nvim/after' ):gsub('\\', '/') ), - (meths.get_option_value('runtimepath', {})):gsub('\\', '/') + (api.nvim_get_option_value('runtimepath', {})):gsub('\\', '/') ) eq( ('.,$XDG_CONFIG_HOME/' .. state_dir .. '/backup//'), - meths.get_option_value('backupdir', {}):gsub('\\', '/') + api.nvim_get_option_value('backupdir', {}):gsub('\\', '/') ) eq( ('$XDG_CONFIG_HOME/' .. state_dir .. '/swap//'), - meths.get_option_value('directory', {}):gsub('\\', '/') + api.nvim_get_option_value('directory', {}):gsub('\\', '/') ) eq( ('$XDG_CONFIG_HOME/' .. state_dir .. '/undo//'), - meths.get_option_value('undodir', {}):gsub('\\', '/') + api.nvim_get_option_value('undodir', {}):gsub('\\', '/') ) eq( ('$XDG_CONFIG_HOME/' .. state_dir .. '/view//'), - meths.get_option_value('viewdir', {}):gsub('\\', '/') + api.nvim_get_option_value('viewdir', {}):gsub('\\', '/') ) - meths.command('set all&') + command('set all&') eq( ( '$XDG_DATA_HOME/nvim' @@ -637,25 +637,25 @@ describe('XDG defaults', function() .. ',$XDG_DATA_DIRS/nvim/after' .. ',$XDG_DATA_HOME/nvim/after' ):gsub('\\', '/'), - (meths.get_option_value('runtimepath', {})):gsub('\\', '/') + (api.nvim_get_option_value('runtimepath', {})):gsub('\\', '/') ) eq( ('.,$XDG_CONFIG_HOME/' .. state_dir .. '/backup//'), - meths.get_option_value('backupdir', {}):gsub('\\', '/') + api.nvim_get_option_value('backupdir', {}):gsub('\\', '/') ) eq( ('$XDG_CONFIG_HOME/' .. state_dir .. '/swap//'), - meths.get_option_value('directory', {}):gsub('\\', '/') + api.nvim_get_option_value('directory', {}):gsub('\\', '/') ) eq( ('$XDG_CONFIG_HOME/' .. state_dir .. '/undo//'), - meths.get_option_value('undodir', {}):gsub('\\', '/') + api.nvim_get_option_value('undodir', {}):gsub('\\', '/') ) eq( ('$XDG_CONFIG_HOME/' .. state_dir .. '/view//'), - meths.get_option_value('viewdir', {}):gsub('\\', '/') + api.nvim_get_option_value('viewdir', {}):gsub('\\', '/') ) - eq(nil, (funcs.tempname()):match('XDG_RUNTIME_DIR')) + eq(nil, (fn.tempname()):match('XDG_RUNTIME_DIR')) end) end) @@ -743,13 +743,13 @@ describe('XDG defaults', function() .. path_sep .. 'after' ), - meths.get_option_value('runtimepath', {}) + api.nvim_get_option_value('runtimepath', {}) ) - meths.command('set runtimepath&') - meths.command('set backupdir&') - meths.command('set directory&') - meths.command('set undodir&') - meths.command('set viewdir&') + command('set runtimepath&') + command('set backupdir&') + command('set directory&') + command('set undodir&') + command('set viewdir&') eq( ( '\\, \\, \\,' @@ -821,11 +821,11 @@ describe('XDG defaults', function() .. path_sep .. 'after' ), - meths.get_option_value('runtimepath', {}) + api.nvim_get_option_value('runtimepath', {}) ) eq( '.,\\,=\\,=\\,' .. path_sep .. state_dir .. '' .. path_sep .. 'backup' .. (path_sep):rep(2), - meths.get_option_value('backupdir', {}) + api.nvim_get_option_value('backupdir', {}) ) eq( '\\,=\\,=\\,' @@ -836,7 +836,7 @@ describe('XDG defaults', function() .. path_sep .. 'swap' .. (path_sep):rep(2), - meths.get_option_value('directory', {}) + api.nvim_get_option_value('directory', {}) ) eq( '\\,=\\,=\\,' @@ -847,7 +847,7 @@ describe('XDG defaults', function() .. path_sep .. 'undo' .. (path_sep):rep(2), - meths.get_option_value('undodir', {}) + api.nvim_get_option_value('undodir', {}) ) eq( '\\,=\\,=\\,' @@ -858,7 +858,7 @@ describe('XDG defaults', function() .. path_sep .. 'view' .. (path_sep):rep(2), - meths.get_option_value('viewdir', {}) + api.nvim_get_option_value('viewdir', {}) ) end) end) @@ -878,29 +878,29 @@ describe('stdpath()', function() it('acceptance', function() clear() -- Do not explicitly set any env vars. - eq('nvim', funcs.fnamemodify(funcs.stdpath('cache'), ':t')) - eq('nvim', funcs.fnamemodify(funcs.stdpath('config'), ':t')) - eq(datadir, funcs.fnamemodify(funcs.stdpath('data'), ':t')) - eq(statedir, funcs.fnamemodify(funcs.stdpath('state'), ':t')) - eq('table', type(funcs.stdpath('config_dirs'))) - eq('table', type(funcs.stdpath('data_dirs'))) - eq('string', type(funcs.stdpath('run'))) + eq('nvim', fn.fnamemodify(fn.stdpath('cache'), ':t')) + eq('nvim', fn.fnamemodify(fn.stdpath('config'), ':t')) + eq(datadir, fn.fnamemodify(fn.stdpath('data'), ':t')) + eq(statedir, fn.fnamemodify(fn.stdpath('state'), ':t')) + eq('table', type(fn.stdpath('config_dirs'))) + eq('table', type(fn.stdpath('data_dirs'))) + eq('string', type(fn.stdpath('run'))) assert_alive() -- Check for crash. #8393 end) it('reacts to $NVIM_APPNAME', function() local appname = 'NVIM_APPNAME_TEST' .. ('_'):rep(106) clear({ env = { NVIM_APPNAME = appname } }) - eq(appname, funcs.fnamemodify(funcs.stdpath('config'), ':t')) - eq(appname, funcs.fnamemodify(funcs.stdpath('cache'), ':t')) - eq(maybe_data(appname), funcs.fnamemodify(funcs.stdpath('log'), ':t')) - eq(maybe_data(appname), funcs.fnamemodify(funcs.stdpath('data'), ':t')) - eq(maybe_data(appname), funcs.fnamemodify(funcs.stdpath('state'), ':t')) + eq(appname, fn.fnamemodify(fn.stdpath('config'), ':t')) + eq(appname, fn.fnamemodify(fn.stdpath('cache'), ':t')) + eq(maybe_data(appname), fn.fnamemodify(fn.stdpath('log'), ':t')) + eq(maybe_data(appname), fn.fnamemodify(fn.stdpath('data'), ':t')) + eq(maybe_data(appname), fn.fnamemodify(fn.stdpath('state'), ':t')) -- config_dirs and data_dirs are empty on windows, so don't check them on -- that platform if not is_os('win') then - eq(appname, funcs.fnamemodify(funcs.stdpath('config_dirs')[1], ':t')) - eq(appname, funcs.fnamemodify(funcs.stdpath('data_dirs')[1], ':t')) + eq(appname, fn.fnamemodify(fn.stdpath('config_dirs')[1], ':t')) + eq(appname, fn.fnamemodify(fn.stdpath('data_dirs')[1], ':t')) end assert_alive() -- Check for crash. #8393 @@ -938,16 +938,16 @@ describe('stdpath()', function() XDG_CONFIG_HOME = alter_slashes('/home/docwhat/.config'), }, }) - eq(alter_slashes('/home/docwhat/.config/nvim'), funcs.stdpath('config')) + eq(alter_slashes('/home/docwhat/.config/nvim'), fn.stdpath('config')) end) it('handles changes during runtime', function() clear({ env = { XDG_CONFIG_HOME = alter_slashes('/home/original'), } }) - eq(alter_slashes('/home/original/nvim'), funcs.stdpath('config')) + eq(alter_slashes('/home/original/nvim'), fn.stdpath('config')) command("let $XDG_CONFIG_HOME='" .. alter_slashes('/home/new') .. "'") - eq(alter_slashes('/home/new/nvim'), funcs.stdpath('config')) + eq(alter_slashes('/home/new/nvim'), fn.stdpath('config')) end) it("doesn't expand $VARIABLES", function() @@ -957,14 +957,14 @@ describe('stdpath()', function() VARIABLES = 'this-should-not-happen', }, }) - eq(alter_slashes('$VARIABLES/nvim'), funcs.stdpath('config')) + eq(alter_slashes('$VARIABLES/nvim'), fn.stdpath('config')) end) it("doesn't expand ~/", function() clear({ env = { XDG_CONFIG_HOME = alter_slashes('~/frobnitz'), } }) - eq(alter_slashes('~/frobnitz/nvim'), funcs.stdpath('config')) + eq(alter_slashes('~/frobnitz/nvim'), fn.stdpath('config')) end) end) @@ -973,16 +973,16 @@ describe('stdpath()', function() clear({ env = { XDG_DATA_HOME = alter_slashes('/home/docwhat/.local'), } }) - eq(alter_slashes('/home/docwhat/.local/' .. datadir), funcs.stdpath('data')) + eq(alter_slashes('/home/docwhat/.local/' .. datadir), fn.stdpath('data')) end) it('handles changes during runtime', function() clear({ env = { XDG_DATA_HOME = alter_slashes('/home/original'), } }) - eq(alter_slashes('/home/original/' .. datadir), funcs.stdpath('data')) + eq(alter_slashes('/home/original/' .. datadir), fn.stdpath('data')) command("let $XDG_DATA_HOME='" .. alter_slashes('/home/new') .. "'") - eq(alter_slashes('/home/new/' .. datadir), funcs.stdpath('data')) + eq(alter_slashes('/home/new/' .. datadir), fn.stdpath('data')) end) it("doesn't expand $VARIABLES", function() @@ -992,14 +992,14 @@ describe('stdpath()', function() VARIABLES = 'this-should-not-happen', }, }) - eq(alter_slashes('$VARIABLES/' .. datadir), funcs.stdpath('data')) + eq(alter_slashes('$VARIABLES/' .. datadir), fn.stdpath('data')) end) it("doesn't expand ~/", function() clear({ env = { XDG_DATA_HOME = alter_slashes('~/frobnitz'), } }) - eq(alter_slashes('~/frobnitz/' .. datadir), funcs.stdpath('data')) + eq(alter_slashes('~/frobnitz/' .. datadir), fn.stdpath('data')) end) end) @@ -1010,16 +1010,16 @@ describe('stdpath()', function() XDG_STATE_HOME = alter_slashes('/home/docwhat/.local'), }, }) - eq(alter_slashes('/home/docwhat/.local/' .. statedir), funcs.stdpath('state')) + eq(alter_slashes('/home/docwhat/.local/' .. statedir), fn.stdpath('state')) end) it('handles changes during runtime', function() clear({ env = { XDG_STATE_HOME = alter_slashes('/home/original'), } }) - eq(alter_slashes('/home/original/' .. statedir), funcs.stdpath('state')) + eq(alter_slashes('/home/original/' .. statedir), fn.stdpath('state')) command("let $XDG_STATE_HOME='" .. alter_slashes('/home/new') .. "'") - eq(alter_slashes('/home/new/' .. statedir), funcs.stdpath('state')) + eq(alter_slashes('/home/new/' .. statedir), fn.stdpath('state')) end) it("doesn't expand $VARIABLES", function() @@ -1029,14 +1029,14 @@ describe('stdpath()', function() VARIABLES = 'this-should-not-happen', }, }) - eq(alter_slashes('$VARIABLES/' .. statedir), funcs.stdpath('state')) + eq(alter_slashes('$VARIABLES/' .. statedir), fn.stdpath('state')) end) it("doesn't expand ~/", function() clear({ env = { XDG_STATE_HOME = alter_slashes('~/frobnitz'), } }) - eq(alter_slashes('~/frobnitz/' .. statedir), funcs.stdpath('state')) + eq(alter_slashes('~/frobnitz/' .. statedir), fn.stdpath('state')) end) end) @@ -1047,16 +1047,16 @@ describe('stdpath()', function() XDG_CACHE_HOME = alter_slashes('/home/docwhat/.cache'), }, }) - eq(alter_slashes('/home/docwhat/.cache/nvim'), funcs.stdpath('cache')) + eq(alter_slashes('/home/docwhat/.cache/nvim'), fn.stdpath('cache')) end) it('handles changes during runtime', function() clear({ env = { XDG_CACHE_HOME = alter_slashes('/home/original'), } }) - eq(alter_slashes('/home/original/nvim'), funcs.stdpath('cache')) + eq(alter_slashes('/home/original/nvim'), fn.stdpath('cache')) command("let $XDG_CACHE_HOME='" .. alter_slashes('/home/new') .. "'") - eq(alter_slashes('/home/new/nvim'), funcs.stdpath('cache')) + eq(alter_slashes('/home/new/nvim'), fn.stdpath('cache')) end) it("doesn't expand $VARIABLES", function() @@ -1066,14 +1066,14 @@ describe('stdpath()', function() VARIABLES = 'this-should-not-happen', }, }) - eq(alter_slashes('$VARIABLES/nvim'), funcs.stdpath('cache')) + eq(alter_slashes('$VARIABLES/nvim'), fn.stdpath('cache')) end) it("doesn't expand ~/", function() clear({ env = { XDG_CACHE_HOME = alter_slashes('~/frobnitz'), } }) - eq(alter_slashes('~/frobnitz/nvim'), funcs.stdpath('cache')) + eq(alter_slashes('~/frobnitz/nvim'), fn.stdpath('cache')) end) end) end) @@ -1112,7 +1112,7 @@ describe('stdpath()', function() local function set_paths_at_runtime(var_name, paths) clear({ env = base_env() }) - meths.set_var('env_val', table.concat(paths, env_sep)) + api.nvim_set_var('env_val', table.concat(paths, env_sep)) command(('let $%s=g:env_val'):format(var_name)) end @@ -1120,12 +1120,12 @@ describe('stdpath()', function() describe(msg, function() it('set via system', function() set_paths_via_system(env_var_name, paths) - eq(expected_paths, funcs.stdpath(stdpath_arg)) + eq(expected_paths, fn.stdpath(stdpath_arg)) end) it('set at runtime', function() set_paths_at_runtime(env_var_name, paths) - eq(expected_paths, funcs.stdpath(stdpath_arg)) + eq(expected_paths, fn.stdpath(stdpath_arg)) end) end) end diff --git a/test/functional/options/num_options_spec.lua b/test/functional/options/num_options_spec.lua index d81b95ab41..0614bcf814 100644 --- a/test/functional/options/num_options_spec.lua +++ b/test/functional/options/num_options_spec.lua @@ -1,8 +1,8 @@ -- Tests for :setlocal and :setglobal local helpers = require('test.functional.helpers')(after_each) -local clear, feed_command, eval, eq, meths = - helpers.clear, helpers.feed_command, helpers.eval, helpers.eq, helpers.meths +local clear, feed_command, eval, eq, api = + helpers.clear, helpers.feed_command, helpers.eval, helpers.eq, helpers.api local function should_fail(opt, value, errmsg) feed_command('setglobal ' .. opt .. '=' .. value) @@ -11,7 +11,7 @@ local function should_fail(opt, value, errmsg) feed_command('setlocal ' .. opt .. '=' .. value) eq(errmsg, eval('v:errmsg'):match('E%d*')) feed_command('let v:errmsg = ""') - local status, err = pcall(meths.set_option_value, opt, value, {}) + local status, err = pcall(api.nvim_set_option_value, opt, value, {}) eq(status, false) eq(errmsg, err:match('E%d*')) eq('', eval('v:errmsg')) @@ -20,8 +20,8 @@ end local function should_succeed(opt, value) feed_command('setglobal ' .. opt .. '=' .. value) feed_command('setlocal ' .. opt .. '=' .. value) - meths.set_option_value(opt, value, {}) - eq(value, meths.get_option_value(opt, {})) + api.nvim_set_option_value(opt, value, {}) + eq(value, api.nvim_get_option_value(opt, {})) eq('', eval('v:errmsg')) end @@ -29,12 +29,12 @@ describe(':setlocal', function() before_each(clear) it('setlocal sets only local value', function() - eq(0, meths.get_option_value('iminsert', { scope = 'global' })) + eq(0, api.nvim_get_option_value('iminsert', { scope = 'global' })) feed_command('setlocal iminsert=1') - eq(0, meths.get_option_value('iminsert', { scope = 'global' })) - eq(-1, meths.get_option_value('imsearch', { scope = 'global' })) + eq(0, api.nvim_get_option_value('iminsert', { scope = 'global' })) + eq(-1, api.nvim_get_option_value('imsearch', { scope = 'global' })) feed_command('setlocal imsearch=1') - eq(-1, meths.get_option_value('imsearch', { scope = 'global' })) + eq(-1, api.nvim_get_option_value('imsearch', { scope = 'global' })) end) end) @@ -77,8 +77,8 @@ describe(':set validation', function() -- If smaller than 1 this one is set to 'lines'-1 feed_command('setglobal window=-10') - meths.set_option_value('window', -10, {}) - eq(23, meths.get_option_value('window', {})) + api.nvim_set_option_value('window', -10, {}) + eq(23, api.nvim_get_option_value('window', {})) eq('', eval('v:errmsg')) -- 'scrolloff' and 'sidescrolloff' can have a -1 value when @@ -112,8 +112,8 @@ describe(':set validation', function() local function setto(value) feed_command('setglobal maxcombine=' .. value) feed_command('setlocal maxcombine=' .. value) - meths.set_option_value('maxcombine', value, {}) - eq(6, meths.get_option_value('maxcombine', {})) + api.nvim_set_option_value('maxcombine', value, {}) + eq(6, api.nvim_get_option_value('maxcombine', {})) eq('', eval('v:errmsg')) end setto(0) |