aboutsummaryrefslogtreecommitdiff
path: root/test/functional/shada/variables_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/shada/variables_spec.lua')
-rw-r--r--test/functional/shada/variables_spec.lua67
1 files changed, 35 insertions, 32 deletions
diff --git a/test/functional/shada/variables_spec.lua b/test/functional/shada/variables_spec.lua
index 49dd5837a7..6096c72bcb 100644
--- a/test/functional/shada/variables_spec.lua
+++ b/test/functional/shada/variables_spec.lua
@@ -12,13 +12,13 @@ describe('ShaDa support code', function()
after_each(clear)
it('is able to dump and read back string variable', function()
- meths.set_var('STRVAR', 'foo')
+ meths.nvim_set_var('STRVAR', 'foo')
nvim_command('set shada+=!')
nvim_command('wshada')
reset()
nvim_command('set shada+=!')
nvim_command('rshada')
- eq('foo', meths.get_var('STRVAR'))
+ eq('foo', meths.nvim_get_var('STRVAR'))
end)
local autotest = function(tname, varname, varval, val_is_expr)
@@ -26,9 +26,9 @@ describe('ShaDa support code', function()
reset('set shada+=!')
if val_is_expr then
nvim_command('let g:' .. varname .. ' = ' .. varval)
- varval = meths.get_var(varname)
+ varval = meths.nvim_get_var(varname)
else
- meths.set_var(varname, varval)
+ meths.nvim_set_var(varname, varval)
end
local vartype = eval('type(g:' .. varname .. ')')
-- Exit during `reset` is not a regular exit: it does not write shada
@@ -36,7 +36,7 @@ describe('ShaDa support code', function()
expect_exit(nvim_command, 'qall')
reset('set shada+=!')
eq(vartype, eval('type(g:' .. varname .. ')'))
- eq(varval, meths.get_var(varname))
+ eq(varval, meths.nvim_get_var(varname))
end)
end
@@ -53,7 +53,7 @@ describe('ShaDa support code', function()
autotest('blob (with NULs)', 'BLOBVARNULS', '0z004e554c7300', true)
it('does not read back variables without `!` in &shada', function()
- meths.set_var('STRVAR', 'foo')
+ meths.nvim_set_var('STRVAR', 'foo')
nvim_command('set shada+=!')
nvim_command('wshada')
reset('set shada-=!')
@@ -63,7 +63,7 @@ describe('ShaDa support code', function()
it('does not dump variables without `!` in &shada', function()
nvim_command('set shada-=!')
- meths.set_var('STRVAR', 'foo')
+ meths.nvim_set_var('STRVAR', 'foo')
nvim_command('wshada')
reset()
nvim_command('set shada+=!')
@@ -73,7 +73,7 @@ describe('ShaDa support code', function()
it('does not dump session variables', function()
nvim_command('set shada+=!')
- meths.set_var('StrVar', 'foo')
+ meths.nvim_set_var('StrVar', 'foo')
nvim_command('wshada')
reset()
nvim_command('set shada+=!')
@@ -83,7 +83,7 @@ describe('ShaDa support code', function()
it('does not dump regular variables', function()
nvim_command('set shada+=!')
- meths.set_var('str_var', 'foo')
+ meths.nvim_set_var('str_var', 'foo')
nvim_command('wshada')
reset()
nvim_command('set shada+=!')
@@ -93,70 +93,73 @@ describe('ShaDa support code', function()
it('dumps and loads variables correctly with utf-8 strings', function()
reset()
- meths.set_var('STRVAR', '«')
- meths.set_var('LSTVAR', { '«' })
- meths.set_var('DCTVAR', { ['«'] = '«' })
- meths.set_var('NESTEDVAR', { ['«'] = { { '«' }, { ['«'] = '«' }, { a = 'Test' } } })
+ meths.nvim_set_var('STRVAR', '«')
+ meths.nvim_set_var('LSTVAR', { '«' })
+ meths.nvim_set_var('DCTVAR', { ['«'] = '«' })
+ meths.nvim_set_var('NESTEDVAR', { ['«'] = { { '«' }, { ['«'] = '«' }, { a = 'Test' } } })
expect_exit(nvim_command, 'qall')
reset()
- eq('«', meths.get_var('STRVAR'))
- eq({ '«' }, meths.get_var('LSTVAR'))
- eq({ ['«'] = '«' }, meths.get_var('DCTVAR'))
- eq({ ['«'] = { { '«' }, { ['«'] = '«' }, { a = 'Test' } } }, meths.get_var('NESTEDVAR'))
+ eq('«', meths.nvim_get_var('STRVAR'))
+ eq({ '«' }, meths.nvim_get_var('LSTVAR'))
+ eq({ ['«'] = '«' }, meths.nvim_get_var('DCTVAR'))
+ eq(
+ { ['«'] = { { '«' }, { ['«'] = '«' }, { a = 'Test' } } },
+ meths.nvim_get_var('NESTEDVAR')
+ )
end)
it('dumps and loads variables correctly with 8-bit strings', function()
reset()
-- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1
-- This is invalid unicode, but we should still dump and restore it.
- meths.set_var('STRVAR', '\171')
- meths.set_var('LSTVAR', { '\171' })
- meths.set_var('DCTVAR', { ['«\171'] = '«\171' })
- meths.set_var(
+ meths.nvim_set_var('STRVAR', '\171')
+ meths.nvim_set_var('LSTVAR', { '\171' })
+ meths.nvim_set_var('DCTVAR', { ['«\171'] = '«\171' })
+ meths.nvim_set_var(
'NESTEDVAR',
{ ['\171'] = { { '\171«' }, { ['\171'] = '\171' }, { a = 'Test' } } }
)
expect_exit(nvim_command, 'qall')
reset()
- eq('\171', meths.get_var('STRVAR'))
- eq({ '\171' }, meths.get_var('LSTVAR'))
- eq({ ['«\171'] = '«\171' }, meths.get_var('DCTVAR'))
+ eq('\171', meths.nvim_get_var('STRVAR'))
+ eq({ '\171' }, meths.nvim_get_var('LSTVAR'))
+ eq({ ['«\171'] = '«\171' }, meths.nvim_get_var('DCTVAR'))
eq(
{ ['\171'] = { { '\171«' }, { ['\171'] = '\171' }, { a = 'Test' } } },
- meths.get_var('NESTEDVAR')
+ meths.nvim_get_var('NESTEDVAR')
)
end)
it('ignore when a funcref is stored in a variable', function()
nvim_command('let F = function("tr")')
- meths.set_var('U', '10')
+ meths.nvim_set_var('U', '10')
nvim_command('set shada+=!')
nvim_command('wshada')
reset()
nvim_command('set shada+=!')
nvim_command('rshada')
- eq('10', meths.get_var('U'))
+ eq('10', meths.nvim_get_var('U'))
end)
it('ignore when a partial is stored in a variable', function()
nvim_command('let P = { -> 1 }')
- meths.set_var('U', '10')
+ meths.nvim_set_var('U', '10')
nvim_command('set shada+=!')
nvim_command('wshada')
reset()
nvim_command('set shada+=!')
nvim_command('rshada')
- eq('10', meths.get_var('U'))
+ eq('10', meths.nvim_get_var('U'))
end)
it('ignore when a self-referencing list is stored in a variable', function()
- meths.set_var('L', {})
+ meths.nvim_set_var('L', {})
nvim_command('call add(L, L)')
- meths.set_var('U', '10')
+ meths.nvim_set_var('U', '10')
nvim_command('set shada+=!')
nvim_command('wshada')
reset()
nvim_command('rshada')
- eq('10', meths.get_var('U'))
+ eq('10', meths.nvim_get_var('U'))
end)
end)