aboutsummaryrefslogtreecommitdiff
path: root/test/functional/shada
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/shada')
-rw-r--r--test/functional/shada/buffers_spec.lua4
-rw-r--r--test/functional/shada/helpers.lua2
-rw-r--r--test/functional/shada/history_spec.lua22
-rw-r--r--test/functional/shada/marks_spec.lua8
-rw-r--r--test/functional/shada/shada_spec.lua38
-rw-r--r--test/functional/shada/variables_spec.lua67
6 files changed, 72 insertions, 69 deletions
diff --git a/test/functional/shada/buffers_spec.lua b/test/functional/shada/buffers_spec.lua
index b16fa975b6..c0fb3815b6 100644
--- a/test/functional/shada/buffers_spec.lua
+++ b/test/functional/shada/buffers_spec.lua
@@ -48,7 +48,7 @@ describe('shada support code', function()
reset('set shada+=%')
nvim_command('edit ' .. testfilename)
nvim_command('edit ' .. testfilename_2)
- meths.set_option_value('buflisted', false, {})
+ meths.nvim_set_option_value('buflisted', false, {})
expect_exit(nvim_command, 'qall')
reset('set shada+=%')
eq(2, funcs.bufnr('$'))
@@ -60,7 +60,7 @@ describe('shada support code', function()
reset('set shada+=%')
nvim_command('edit ' .. testfilename)
nvim_command('edit ' .. testfilename_2)
- meths.set_option_value('buftype', 'quickfix', {})
+ meths.nvim_set_option_value('buftype', 'quickfix', {})
expect_exit(nvim_command, 'qall')
reset('set shada+=%')
eq(2, funcs.bufnr('$'))
diff --git a/test/functional/shada/helpers.lua b/test/functional/shada/helpers.lua
index d8ffdaf753..5235458528 100644
--- a/test/functional/shada/helpers.lua
+++ b/test/functional/shada/helpers.lua
@@ -28,7 +28,7 @@ local function reset(o)
args_rm = args_rm,
args = args,
}
- meths.set_var('tmpname', tmpname)
+ meths.nvim_set_var('tmpname', tmpname)
end
local clear = function()
diff --git a/test/functional/shada/history_spec.lua b/test/functional/shada/history_spec.lua
index 476036312d..da0ce2def7 100644
--- a/test/functional/shada/history_spec.lua
+++ b/test/functional/shada/history_spec.lua
@@ -104,40 +104,40 @@ describe('ShaDa support code', function()
end)
it('dumps and loads last search pattern with offset', function()
- meths.set_option_value('wrapscan', false, {})
+ meths.nvim_set_option_value('wrapscan', false, {})
funcs.setline('.', { 'foo', 'bar--' })
nvim_feed('gg0/a/e+1\n')
eq({ 0, 2, 3, 0 }, funcs.getpos('.'))
nvim_command('wshada')
reset()
- meths.set_option_value('wrapscan', false, {})
+ meths.nvim_set_option_value('wrapscan', false, {})
funcs.setline('.', { 'foo', 'bar--' })
nvim_feed('gg0n')
eq({ 0, 2, 3, 0 }, funcs.getpos('.'))
- eq(1, meths.get_vvar('searchforward'))
+ eq(1, meths.nvim_get_vvar('searchforward'))
end)
it('dumps and loads last search pattern with offset and backward direction', function()
- meths.set_option_value('wrapscan', false, {})
+ meths.nvim_set_option_value('wrapscan', false, {})
funcs.setline('.', { 'foo', 'bar--' })
nvim_feed('G$?a?e+1\n')
eq({ 0, 2, 3, 0 }, funcs.getpos('.'))
nvim_command('wshada')
reset()
- meths.set_option_value('wrapscan', false, {})
+ meths.nvim_set_option_value('wrapscan', false, {})
funcs.setline('.', { 'foo', 'bar--' })
nvim_feed('G$n')
eq({ 0, 2, 3, 0 }, funcs.getpos('.'))
- eq(0, meths.get_vvar('searchforward'))
+ eq(0, meths.nvim_get_vvar('searchforward'))
end)
it('saves v:hlsearch=1', function()
nvim_command('set hlsearch shada-=h')
nvim_feed('/test\n')
- eq(1, meths.get_vvar('hlsearch'))
+ eq(1, meths.nvim_get_vvar('hlsearch'))
expect_exit(nvim_command, 'qall')
reset()
- eq(1, meths.get_vvar('hlsearch'))
+ eq(1, meths.nvim_get_vvar('hlsearch'))
end)
it('saves v:hlsearch=0 with :nohl', function()
@@ -146,16 +146,16 @@ describe('ShaDa support code', function()
nvim_command('nohlsearch')
expect_exit(nvim_command, 'qall')
reset()
- eq(0, meths.get_vvar('hlsearch'))
+ eq(0, meths.nvim_get_vvar('hlsearch'))
end)
it('saves v:hlsearch=0 with default &shada', function()
nvim_command('set hlsearch')
nvim_feed('/test\n')
- eq(1, meths.get_vvar('hlsearch'))
+ eq(1, meths.nvim_get_vvar('hlsearch'))
expect_exit(nvim_command, 'qall')
reset()
- eq(0, meths.get_vvar('hlsearch'))
+ eq(0, meths.nvim_get_vvar('hlsearch'))
end)
it('dumps and loads last substitute pattern and replacement string', function()
diff --git a/test/functional/shada/marks_spec.lua b/test/functional/shada/marks_spec.lua
index a1c851a9d5..b50df23be4 100644
--- a/test/functional/shada/marks_spec.lua
+++ b/test/functional/shada/marks_spec.lua
@@ -124,7 +124,7 @@ describe('ShaDa support code', function()
local tf_full_2 = curbufmeths.get_name()
expect_exit(nvim_command, 'qall')
reset()
- local oldfiles = meths.get_vvar('oldfiles')
+ local oldfiles = meths.nvim_get_vvar('oldfiles')
table.sort(oldfiles)
eq(2, #oldfiles)
eq(testfilename, oldfiles[1]:sub(-#testfilename))
@@ -132,7 +132,7 @@ describe('ShaDa support code', function()
eq(tf_full, oldfiles[1])
eq(tf_full_2, oldfiles[2])
nvim_command('rshada!')
- oldfiles = meths.get_vvar('oldfiles')
+ oldfiles = meths.nvim_get_vvar('oldfiles')
table.sort(oldfiles)
eq(2, #oldfiles)
eq(testfilename, oldfiles[1]:sub(-#testfilename))
@@ -229,7 +229,7 @@ describe('ShaDa support code', function()
},
args = {
'-i',
- meths.get_var('tmpname'), -- Use same shada file as parent.
+ meths.nvim_get_var('tmpname'), -- Use same shada file as parent.
'--cmd',
'silent edit ' .. non_existent_testfilename,
'-c',
@@ -248,7 +248,7 @@ describe('ShaDa support code', function()
},
args = {
'-i',
- meths.get_var('tmpname'), -- Use same shada file as parent.
+ meths.nvim_get_var('tmpname'), -- Use same shada file as parent.
'-c',
'silent edit ' .. non_existent_testfilename,
'-c',
diff --git a/test/functional/shada/shada_spec.lua b/test/functional/shada/shada_spec.lua
index 4b52c1835b..b16a19ef31 100644
--- a/test/functional/shada/shada_spec.lua
+++ b/test/functional/shada/shada_spec.lua
@@ -175,7 +175,7 @@ describe('ShaDa support code', function()
it('correctly uses shada-r option', function()
nvim_command('set shellslash')
- meths.set_var('__home', paths.test_source_path)
+ meths.nvim_set_var('__home', paths.test_source_path)
nvim_command('let $HOME = __home')
nvim_command('unlet __home')
nvim_command('edit ~/README.md')
@@ -203,7 +203,7 @@ describe('ShaDa support code', function()
local pwd = funcs.getcwd()
local relfname = 'абв/test'
local fname = pwd .. '/' .. relfname
- meths.set_var('__fname', fname)
+ meths.nvim_set_var('__fname', fname)
nvim_command('silent! edit `=__fname`')
funcs.setline(1, { 'a', 'b', 'c', 'd' })
nvim_command('normal! GmAggmaAabc')
@@ -217,30 +217,30 @@ describe('ShaDa support code', function()
end)
it('is able to set &shada after &viminfo', function()
- meths.set_option_value('viminfo', "'10", {})
- eq("'10", meths.get_option_value('viminfo', {}))
- eq("'10", meths.get_option_value('shada', {}))
- meths.set_option_value('shada', '', {})
- eq('', meths.get_option_value('viminfo', {}))
- eq('', meths.get_option_value('shada', {}))
+ meths.nvim_set_option_value('viminfo', "'10", {})
+ eq("'10", meths.nvim_get_option_value('viminfo', {}))
+ eq("'10", meths.nvim_get_option_value('shada', {}))
+ meths.nvim_set_option_value('shada', '', {})
+ eq('', meths.nvim_get_option_value('viminfo', {}))
+ eq('', meths.nvim_get_option_value('shada', {}))
end)
it('is able to set all& after setting &shada', function()
- meths.set_option_value('shada', "'10", {})
- eq("'10", meths.get_option_value('viminfo', {}))
- eq("'10", meths.get_option_value('shada', {}))
+ meths.nvim_set_option_value('shada', "'10", {})
+ eq("'10", meths.nvim_get_option_value('viminfo', {}))
+ eq("'10", meths.nvim_get_option_value('shada', {}))
nvim_command('set all&')
- eq("!,'100,<50,s10,h", meths.get_option_value('viminfo', {}))
- eq("!,'100,<50,s10,h", meths.get_option_value('shada', {}))
+ eq("!,'100,<50,s10,h", meths.nvim_get_option_value('viminfo', {}))
+ eq("!,'100,<50,s10,h", meths.nvim_get_option_value('shada', {}))
end)
it('is able to set &shada after &viminfo using :set', function()
nvim_command("set viminfo='10")
- eq("'10", meths.get_option_value('viminfo', {}))
- eq("'10", meths.get_option_value('shada', {}))
+ eq("'10", meths.nvim_get_option_value('viminfo', {}))
+ eq("'10", meths.nvim_get_option_value('shada', {}))
nvim_command('set shada=')
- eq('', meths.get_option_value('viminfo', {}))
- eq('', meths.get_option_value('shada', {}))
+ eq('', meths.nvim_get_option_value('viminfo', {}))
+ eq('', meths.nvim_get_option_value('shada', {}))
end)
it('setting &shada gives proper error message on missing number', function()
@@ -259,14 +259,14 @@ describe('ShaDa support code', function()
funcs.mkdir(dirname, '', 0)
eq(0, funcs.filewritable(dirname))
reset { shadafile = dirshada, args = { '--cmd', 'set shada=' } }
- meths.set_option_value('shada', "'10", {})
+ meths.nvim_set_option_value('shada', "'10", {})
eq(
'Vim(wshada):E886: System error while opening ShaDa file '
.. 'Xtest-functional-shada-shada.d/main.shada for reading to merge '
.. 'before writing it: permission denied',
exc_exec('wshada')
)
- meths.set_option_value('shada', '', {})
+ meths.nvim_set_option_value('shada', '', {})
end)
end)
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)