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.lua50
-rw-r--r--test/functional/shada/compatibility_spec.lua120
-rw-r--r--test/functional/shada/helpers.lua4
-rw-r--r--test/functional/shada/history_spec.lua108
-rw-r--r--test/functional/shada/marks_spec.lua40
-rw-r--r--test/functional/shada/merging_spec.lua102
-rw-r--r--test/functional/shada/registers_spec.lua8
-rw-r--r--test/functional/shada/shada_spec.lua60
-rw-r--r--test/functional/shada/variables_spec.lua79
9 files changed, 283 insertions, 288 deletions
diff --git a/test/functional/shada/buffers_spec.lua b/test/functional/shada/buffers_spec.lua
index 06b7167525..9fead98fed 100644
--- a/test/functional/shada/buffers_spec.lua
+++ b/test/functional/shada/buffers_spec.lua
@@ -1,6 +1,6 @@
-- shada buffer list saving/reading support
local helpers = require('test.functional.helpers')(after_each)
-local nvim_command, funcs, eq, meths = helpers.command, helpers.funcs, helpers.eq, helpers.meths
+local nvim_command, fn, eq, api = helpers.command, helpers.fn, helpers.eq, helpers.api
local expect_exit = helpers.expect_exit
local shada_helpers = require('test.functional.shada.helpers')
@@ -17,10 +17,10 @@ describe('shada support code', function()
nvim_command('edit ' .. testfilename_2)
expect_exit(nvim_command, 'qall')
reset('set shada+=%')
- eq(3, funcs.bufnr('$'))
- eq('', funcs.bufname(1))
- eq(testfilename, funcs.bufname(2))
- eq(testfilename_2, funcs.bufname(3))
+ eq(3, fn.bufnr('$'))
+ eq('', fn.bufname(1))
+ eq(testfilename, fn.bufname(2))
+ eq(testfilename_2, fn.bufname(3))
end)
it('does not restore buffer list without % in &shada', function()
@@ -29,8 +29,8 @@ describe('shada support code', function()
nvim_command('edit ' .. testfilename_2)
expect_exit(nvim_command, 'qall')
reset()
- eq(1, funcs.bufnr('$'))
- eq('', funcs.bufname(1))
+ eq(1, fn.bufnr('$'))
+ eq('', fn.bufname(1))
end)
it('does not dump buffer list without % in &shada', function()
@@ -39,44 +39,44 @@ describe('shada support code', function()
nvim_command('edit ' .. testfilename_2)
expect_exit(nvim_command, 'qall')
reset('set shada+=%')
- eq(1, funcs.bufnr('$'))
- eq('', funcs.bufname(1))
+ eq(1, fn.bufnr('$'))
+ eq('', fn.bufname(1))
end)
it('does not dump unlisted buffer', function()
reset('set shada+=%')
nvim_command('edit ' .. testfilename)
nvim_command('edit ' .. testfilename_2)
- meths.nvim_set_option_value('buflisted', false, {})
+ api.nvim_set_option_value('buflisted', false, {})
expect_exit(nvim_command, 'qall')
reset('set shada+=%')
- eq(2, funcs.bufnr('$'))
- eq('', funcs.bufname(1))
- eq(testfilename, funcs.bufname(2))
+ eq(2, fn.bufnr('$'))
+ eq('', fn.bufname(1))
+ eq(testfilename, fn.bufname(2))
end)
it('does not dump quickfix buffer', function()
reset('set shada+=%')
nvim_command('edit ' .. testfilename)
nvim_command('edit ' .. testfilename_2)
- meths.nvim_set_option_value('buftype', 'quickfix', {})
+ api.nvim_set_option_value('buftype', 'quickfix', {})
expect_exit(nvim_command, 'qall')
reset('set shada+=%')
- eq(2, funcs.bufnr('$'))
- eq('', funcs.bufname(1))
- eq(testfilename, funcs.bufname(2))
+ eq(2, fn.bufnr('$'))
+ eq('', fn.bufname(1))
+ eq(testfilename, fn.bufname(2))
end)
it('does not dump unnamed buffers', function()
reset('set shada+=% hidden')
- meths.nvim_buf_set_lines(0, 0, 1, true, { 'foo' })
+ api.nvim_buf_set_lines(0, 0, 1, true, { 'foo' })
nvim_command('enew')
- meths.nvim_buf_set_lines(0, 0, 1, true, { 'bar' })
- eq(2, funcs.bufnr('$'))
+ api.nvim_buf_set_lines(0, 0, 1, true, { 'bar' })
+ eq(2, fn.bufnr('$'))
expect_exit(nvim_command, 'qall!')
reset('set shada+=% hidden')
- eq(1, funcs.bufnr('$'))
- eq('', funcs.bufname(1))
+ eq(1, fn.bufnr('$'))
+ eq('', fn.bufname(1))
end)
it('restores 1 buffer with %1 in &shada, #5759', function()
@@ -85,8 +85,8 @@ describe('shada support code', function()
nvim_command('edit ' .. testfilename_2)
expect_exit(nvim_command, 'qall')
reset('set shada+=%1')
- eq(2, funcs.bufnr('$'))
- eq('', funcs.bufname(1))
- eq(testfilename, funcs.bufname(2))
+ eq(2, fn.bufnr('$'))
+ eq('', fn.bufname(1))
+ eq(testfilename, fn.bufname(2))
end)
end)
diff --git a/test/functional/shada/compatibility_spec.lua b/test/functional/shada/compatibility_spec.lua
index 13797590f7..bc4e9675c6 100644
--- a/test/functional/shada/compatibility_spec.lua
+++ b/test/functional/shada/compatibility_spec.lua
@@ -1,6 +1,6 @@
-- ShaDa compatibility support
local helpers = require('test.functional.helpers')(after_each)
-local nvim_command, funcs, eq = helpers.command, helpers.funcs, helpers.eq
+local nvim_command, fn, eq = helpers.command, helpers.fn, helpers.eq
local exc_exec = helpers.exc_exec
local shada_helpers = require('test.functional.shada.helpers')
@@ -49,11 +49,11 @@ describe('ShaDa forward compatibility support code', function()
end
end
eq(true, found)
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
nvim_command('rshada! ' .. shada_fname)
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
end)
it('works with s/search pattern item with BOOL unknown (sX) key value', function()
@@ -81,11 +81,11 @@ describe('ShaDa forward compatibility support code', function()
end
end
eq(true, found)
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
nvim_command('rshada!' .. shada_fname)
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
end)
it('works with replacement item with BOOL additional value in list', function()
@@ -114,11 +114,11 @@ describe('ShaDa forward compatibility support code', function()
end
end
eq(true, found)
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
nvim_command('rshada!' .. shada_fname)
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
end)
for _, v in ipairs({
@@ -138,8 +138,8 @@ describe('ShaDa forward compatibility support code', function()
}) do
it('works with ' .. v.name .. ' item with BOOL unknown (mX) key value', function()
nvim_command('silent noautocmd edit ' .. mock_file_path .. 'c')
- eq('' .. mock_file_path .. 'c', funcs.bufname('%'))
- funcs.setline('.', { '1', '2', '3' })
+ eq('' .. mock_file_path .. 'c', fn.bufname('%'))
+ fn.setline('.', { '1', '2', '3' })
wshada(v.mpack)
eq(0, exc_exec(sdrcmd(true)))
os.remove(shada_fname)
@@ -155,7 +155,7 @@ describe('ShaDa forward compatibility support code', function()
eq(true, found)
eq(0, exc_exec(sdrcmd()))
nvim_command('bwipeout!')
- funcs.setpos("'A", { 0, 1, 1, 0 })
+ fn.setpos("'A", { 0, 1, 1, 0 })
os.remove(shada_fname)
nvim_command('wshada ' .. shada_fname)
found = false
@@ -167,18 +167,18 @@ describe('ShaDa forward compatibility support code', function()
end
end
eq(false, found)
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
nvim_command('rshada!' .. shada_fname)
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
end)
if v.name == 'global mark' or v.name == 'local mark' then
it('works with ' .. v.name .. ' item with <C-a> name', function()
nvim_command('silent noautocmd edit ' .. mock_file_path .. 'c')
- eq('' .. mock_file_path .. 'c', funcs.bufname('%'))
- funcs.setline('.', { '1', '2', '3' })
+ eq('' .. mock_file_path .. 'c', fn.bufname('%'))
+ fn.setline('.', { '1', '2', '3' })
wshada(
v.mpack:gsub('n.$', 'n\001')
.. v.mpack:gsub('n.$', 'n\002')
@@ -213,11 +213,11 @@ describe('ShaDa forward compatibility support code', function()
end
end
eq(0, found)
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
nvim_command('rshada!' .. shada_fname)
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
end)
end
end
@@ -245,11 +245,11 @@ describe('ShaDa forward compatibility support code', function()
end
end
eq(false, found)
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
nvim_command('rshada!' .. shada_fname)
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
end)
it('works with register item with <C-a> name', function()
@@ -281,18 +281,18 @@ describe('ShaDa forward compatibility support code', function()
end
end
eq(0, found)
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
nvim_command('rshada!' .. shada_fname)
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
end)
it('works with register item with type 10', function()
wshada('\005\001\019\132\161na\162rX\194\162rc\145\196\001-\162rt\010')
eq(0, exc_exec(sdrcmd(true)))
- eq({}, funcs.getreg('a', 1, 1))
- eq('', funcs.getregtype('a'))
+ eq({}, fn.getreg('a', 1, 1))
+ eq('', fn.getregtype('a'))
nvim_command('wshada ' .. shada_fname)
local found = 0
for i, v in ipairs(read_shada_file(shada_fname)) do
@@ -319,19 +319,19 @@ describe('ShaDa forward compatibility support code', function()
end
end
eq(0, found)
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
nvim_command('rshada!' .. shada_fname)
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
end)
it('works with buffer list item with BOOL unknown (bX) key', function()
nvim_command('set shada+=%')
wshada('\009\000\016\145\130\161f\196\006' .. mock_file_path .. 'c\162bX\195')
eq(0, exc_exec(sdrcmd()))
- eq(2, funcs.bufnr('$'))
- eq('' .. mock_file_path .. 'c', funcs.bufname(2))
+ eq(2, fn.bufnr('$'))
+ eq('' .. mock_file_path .. 'c', fn.bufname(2))
os.remove(shada_fname)
nvim_command('wshada ' .. shada_fname)
local found = false
@@ -354,11 +354,11 @@ describe('ShaDa forward compatibility support code', function()
end
eq(false, found)
nvim_command('bwipeout!')
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
nvim_command('rshada!' .. shada_fname)
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
end)
it('works with history item with BOOL additional value in list', function()
@@ -377,8 +377,8 @@ describe('ShaDa forward compatibility support code', function()
eq(true, found)
eq(0, exc_exec(sdrcmd()))
os.remove(shada_fname)
- funcs.histadd(':', '--')
- funcs.histadd(':', '-')
+ fn.histadd(':', '--')
+ fn.histadd(':', '-')
nvim_command('wshada ' .. shada_fname)
found = false
for _, v in ipairs(read_shada_file(shada_fname)) do
@@ -388,11 +388,11 @@ describe('ShaDa forward compatibility support code', function()
end
end
eq(true, found)
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
nvim_command('rshada!' .. shada_fname)
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
end)
it('works with history item with type 10', function()
@@ -425,11 +425,11 @@ describe('ShaDa forward compatibility support code', function()
end
end
eq(0, found)
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
nvim_command('rshada!' .. shada_fname)
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
end)
it('works with item with 100 type', function()
@@ -462,10 +462,10 @@ describe('ShaDa forward compatibility support code', function()
end
end
eq(0, found)
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
nvim_command('rshada!' .. shada_fname)
- funcs.garbagecollect(1)
- funcs.garbagecollect(1)
+ fn.garbagecollect(1)
+ fn.garbagecollect(1)
end)
end)
diff --git a/test/functional/shada/helpers.lua b/test/functional/shada/helpers.lua
index 5235458528..baa27889f3 100644
--- a/test/functional/shada/helpers.lua
+++ b/test/functional/shada/helpers.lua
@@ -1,5 +1,5 @@
local helpers = require('test.functional.helpers')(nil)
-local meths = helpers.meths
+local api = helpers.api
local write_file = helpers.write_file
local concat_tables = helpers.concat_tables
@@ -28,7 +28,7 @@ local function reset(o)
args_rm = args_rm,
args = args,
}
- meths.nvim_set_var('tmpname', tmpname)
+ api.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 da0ce2def7..c8a19bb082 100644
--- a/test/functional/shada/history_spec.lua
+++ b/test/functional/shada/history_spec.lua
@@ -1,7 +1,7 @@
-- ShaDa history saving/reading support
local helpers = require('test.functional.helpers')(after_each)
-local nvim_command, funcs, meths, nvim_feed, eq =
- helpers.command, helpers.funcs, helpers.meths, helpers.feed, helpers.eq
+local nvim_command, fn, api, nvim_feed, eq =
+ helpers.command, helpers.fn, helpers.api, helpers.feed, helpers.eq
local assert_alive = helpers.assert_alive
local expect_exit = helpers.expect_exit
@@ -19,7 +19,7 @@ describe('ShaDa support code', function()
reset()
nvim_command("set shada='0")
nvim_command('rshada')
- eq('" Test', funcs.histget(':', -1))
+ eq('" Test', fn.histget(':', -1))
end)
it('is able to dump and read back 2 items in command-line history', function()
@@ -30,8 +30,8 @@ describe('ShaDa support code', function()
reset()
nvim_command("set shada='0 history=2")
nvim_command('rshada')
- eq('" Test 2', funcs.histget(':', -1))
- eq('" Test', funcs.histget(':', -2))
+ eq('" Test 2', fn.histget(':', -1))
+ eq('" Test', fn.histget(':', -2))
end)
it('respects &history when dumping', function()
@@ -42,8 +42,8 @@ describe('ShaDa support code', function()
reset()
nvim_command("set shada='0 history=2")
nvim_command('rshada')
- eq('" Test 2', funcs.histget(':', -1))
- eq('', funcs.histget(':', -2))
+ eq('" Test 2', fn.histget(':', -1))
+ eq('', fn.histget(':', -2))
end)
it('respects &history when loading', function()
@@ -54,8 +54,8 @@ describe('ShaDa support code', function()
reset()
nvim_command("set shada='0 history=1")
nvim_command('rshada')
- eq('" Test 2', funcs.histget(':', -1))
- eq('', funcs.histget(':', -2))
+ eq('" Test 2', fn.histget(':', -1))
+ eq('', fn.histget(':', -2))
end)
it('dumps only requested amount of command-line history items', function()
@@ -64,13 +64,13 @@ describe('ShaDa support code', function()
nvim_feed(':" Test 2\n')
nvim_command('wshada')
-- Regression test: :wshada should not alter or free history.
- eq('" Test 2', funcs.histget(':', -1))
- eq('" Test', funcs.histget(':', -2))
+ eq('" Test 2', fn.histget(':', -1))
+ eq('" Test', fn.histget(':', -2))
reset()
nvim_command("set shada='0")
nvim_command('rshada')
- eq('" Test 2', funcs.histget(':', -1))
- eq('', funcs.histget(':', -2))
+ eq('" Test 2', fn.histget(':', -1))
+ eq('', fn.histget(':', -2))
end)
it('does not respect number in &shada when loading history', function()
@@ -81,8 +81,8 @@ describe('ShaDa support code', function()
reset()
nvim_command("set shada='0,:1")
nvim_command('rshada')
- eq('" Test 2', funcs.histget(':', -1))
- eq('" Test', funcs.histget(':', -2))
+ eq('" Test 2', fn.histget(':', -1))
+ eq('" Test', fn.histget(':', -2))
end)
it('dumps and loads all kinds of histories', function()
@@ -96,48 +96,48 @@ describe('ShaDa support code', function()
nvim_command('wshada')
reset()
nvim_command('rshada')
- eq('" Test', funcs.histget(':', -1))
- eq('Test', funcs.histget('/', -1))
- eq('"Test"', funcs.histget('=', -1))
- eq('Test 2', funcs.histget('@', -1))
- eq('c', funcs.histget('>', -1))
+ eq('" Test', fn.histget(':', -1))
+ eq('Test', fn.histget('/', -1))
+ eq('"Test"', fn.histget('=', -1))
+ eq('Test 2', fn.histget('@', -1))
+ eq('c', fn.histget('>', -1))
end)
it('dumps and loads last search pattern with offset', function()
- meths.nvim_set_option_value('wrapscan', false, {})
- funcs.setline('.', { 'foo', 'bar--' })
+ api.nvim_set_option_value('wrapscan', false, {})
+ fn.setline('.', { 'foo', 'bar--' })
nvim_feed('gg0/a/e+1\n')
- eq({ 0, 2, 3, 0 }, funcs.getpos('.'))
+ eq({ 0, 2, 3, 0 }, fn.getpos('.'))
nvim_command('wshada')
reset()
- meths.nvim_set_option_value('wrapscan', false, {})
- funcs.setline('.', { 'foo', 'bar--' })
+ api.nvim_set_option_value('wrapscan', false, {})
+ fn.setline('.', { 'foo', 'bar--' })
nvim_feed('gg0n')
- eq({ 0, 2, 3, 0 }, funcs.getpos('.'))
- eq(1, meths.nvim_get_vvar('searchforward'))
+ eq({ 0, 2, 3, 0 }, fn.getpos('.'))
+ eq(1, api.nvim_get_vvar('searchforward'))
end)
it('dumps and loads last search pattern with offset and backward direction', function()
- meths.nvim_set_option_value('wrapscan', false, {})
- funcs.setline('.', { 'foo', 'bar--' })
+ api.nvim_set_option_value('wrapscan', false, {})
+ fn.setline('.', { 'foo', 'bar--' })
nvim_feed('G$?a?e+1\n')
- eq({ 0, 2, 3, 0 }, funcs.getpos('.'))
+ eq({ 0, 2, 3, 0 }, fn.getpos('.'))
nvim_command('wshada')
reset()
- meths.nvim_set_option_value('wrapscan', false, {})
- funcs.setline('.', { 'foo', 'bar--' })
+ api.nvim_set_option_value('wrapscan', false, {})
+ fn.setline('.', { 'foo', 'bar--' })
nvim_feed('G$n')
- eq({ 0, 2, 3, 0 }, funcs.getpos('.'))
- eq(0, meths.nvim_get_vvar('searchforward'))
+ eq({ 0, 2, 3, 0 }, fn.getpos('.'))
+ eq(0, api.nvim_get_vvar('searchforward'))
end)
it('saves v:hlsearch=1', function()
nvim_command('set hlsearch shada-=h')
nvim_feed('/test\n')
- eq(1, meths.nvim_get_vvar('hlsearch'))
+ eq(1, api.nvim_get_vvar('hlsearch'))
expect_exit(nvim_command, 'qall')
reset()
- eq(1, meths.nvim_get_vvar('hlsearch'))
+ eq(1, api.nvim_get_vvar('hlsearch'))
end)
it('saves v:hlsearch=0 with :nohl', function()
@@ -146,27 +146,27 @@ describe('ShaDa support code', function()
nvim_command('nohlsearch')
expect_exit(nvim_command, 'qall')
reset()
- eq(0, meths.nvim_get_vvar('hlsearch'))
+ eq(0, api.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.nvim_get_vvar('hlsearch'))
+ eq(1, api.nvim_get_vvar('hlsearch'))
expect_exit(nvim_command, 'qall')
reset()
- eq(0, meths.nvim_get_vvar('hlsearch'))
+ eq(0, api.nvim_get_vvar('hlsearch'))
end)
it('dumps and loads last substitute pattern and replacement string', function()
- funcs.setline('.', { 'foo', 'bar' })
+ fn.setline('.', { 'foo', 'bar' })
nvim_command('%s/f/g/g')
- eq('goo', funcs.getline(1))
+ eq('goo', fn.getline(1))
nvim_command('wshada')
reset()
- funcs.setline('.', { 'foo', 'bar' })
+ fn.setline('.', { 'foo', 'bar' })
nvim_command('&')
- eq('goo', funcs.getline(1))
+ eq('goo', fn.getline(1))
end)
it('dumps and loads history with UTF-8 characters', function()
@@ -174,25 +174,25 @@ describe('ShaDa support code', function()
nvim_feed(':echo "«"\n')
expect_exit(nvim_command, 'qall')
reset()
- eq('echo "«"', funcs.histget(':', -1))
+ eq('echo "«"', fn.histget(':', -1))
end)
it('dumps and loads replacement with UTF-8 characters', function()
nvim_command('substitute/./«/ge')
expect_exit(nvim_command, 'qall!')
reset()
- funcs.setline('.', { '.' })
+ fn.setline('.', { '.' })
nvim_command('&')
- eq('«', funcs.getline('.'))
+ eq('«', fn.getline('.'))
end)
it('dumps and loads substitute pattern with UTF-8 characters', function()
nvim_command('substitute/«/./ge')
expect_exit(nvim_command, 'qall!')
reset()
- funcs.setline('.', { '«\171' })
+ fn.setline('.', { '«\171' })
nvim_command('&')
- eq('.\171', funcs.getline('.'))
+ eq('.\171', fn.getline('.'))
end)
it('dumps and loads search pattern with UTF-8 characters', function()
@@ -200,10 +200,10 @@ describe('ShaDa support code', function()
nvim_command('set shada+=/0')
expect_exit(nvim_command, 'qall!')
reset()
- funcs.setline('.', { '\171«' })
+ fn.setline('.', { '\171«' })
nvim_command('~&')
- eq('\171', funcs.getline('.'))
- eq('', funcs.histget('/', -1))
+ eq('\171', fn.getline('.'))
+ eq('', fn.histget('/', -1))
end)
it('dumps and loads search pattern with 8-bit single-byte', function()
@@ -212,10 +212,10 @@ describe('ShaDa support code', function()
nvim_command('set shada+=/0')
expect_exit(nvim_command, 'qall!')
reset()
- funcs.setline('.', { '\171«' })
+ fn.setline('.', { '\171«' })
nvim_command('~&')
- eq('«', funcs.getline('.'))
- eq('', funcs.histget('/', -1))
+ eq('«', fn.getline('.'))
+ eq('', fn.histget('/', -1))
end)
it('does not crash when dumping last search pattern (#10945)', function()
diff --git a/test/functional/shada/marks_spec.lua b/test/functional/shada/marks_spec.lua
index 0850084d98..3f29a02506 100644
--- a/test/functional/shada/marks_spec.lua
+++ b/test/functional/shada/marks_spec.lua
@@ -1,6 +1,6 @@
-- ShaDa marks saving/reading support
local helpers = require('test.functional.helpers')(after_each)
-local meths, nvim_command, funcs, eq = helpers.meths, helpers.command, helpers.funcs, helpers.eq
+local api, nvim_command, fn, eq = helpers.api, helpers.command, helpers.fn, helpers.eq
local feed = helpers.feed
local exc_exec, exec_capture = helpers.exc_exec, helpers.exec_capture
local expect_exit = helpers.expect_exit
@@ -9,7 +9,7 @@ local shada_helpers = require('test.functional.shada.helpers')
local reset, clear = shada_helpers.reset, shada_helpers.clear
local nvim_current_line = function()
- return meths.nvim_win_get_cursor(0)[1]
+ return api.nvim_win_get_cursor(0)[1]
end
describe('ShaDa support code', function()
@@ -43,7 +43,7 @@ describe('ShaDa support code', function()
reset()
nvim_command('rshada')
nvim_command('normal! `A')
- eq(testfilename, funcs.fnamemodify(meths.nvim_buf_get_name(0), ':t'))
+ eq(testfilename, fn.fnamemodify(api.nvim_buf_get_name(0), ':t'))
eq(1, nvim_current_line())
nvim_command('normal! `B')
eq(2, nvim_current_line())
@@ -70,7 +70,7 @@ describe('ShaDa support code', function()
reset("set shada='0,f0")
nvim_command('language C')
nvim_command('normal! `A')
- eq(testfilename, funcs.fnamemodify(meths.nvim_buf_get_name(0), ':t'))
+ eq(testfilename, fn.fnamemodify(api.nvim_buf_get_name(0), ':t'))
eq(1, nvim_current_line())
end)
@@ -83,7 +83,7 @@ describe('ShaDa support code', function()
reset()
nvim_command('edit ' .. testfilename)
nvim_command('normal! `a')
- eq(testfilename, funcs.fnamemodify(meths.nvim_buf_get_name(0), ':t'))
+ eq(testfilename, fn.fnamemodify(api.nvim_buf_get_name(0), ':t'))
eq(1, nvim_current_line())
nvim_command('normal! `b')
eq(2, nvim_current_line())
@@ -113,12 +113,12 @@ describe('ShaDa support code', function()
it('is able to populate v:oldfiles', function()
nvim_command('edit ' .. testfilename)
- local tf_full = meths.nvim_buf_get_name(0)
+ local tf_full = api.nvim_buf_get_name(0)
nvim_command('edit ' .. testfilename_2)
- local tf_full_2 = meths.nvim_buf_get_name(0)
+ local tf_full_2 = api.nvim_buf_get_name(0)
expect_exit(nvim_command, 'qall')
reset()
- local oldfiles = meths.nvim_get_vvar('oldfiles')
+ local oldfiles = api.nvim_get_vvar('oldfiles')
table.sort(oldfiles)
eq(2, #oldfiles)
eq(testfilename, oldfiles[1]:sub(-#testfilename))
@@ -126,7 +126,7 @@ describe('ShaDa support code', function()
eq(tf_full, oldfiles[1])
eq(tf_full_2, oldfiles[2])
nvim_command('rshada!')
- oldfiles = meths.nvim_get_vvar('oldfiles')
+ oldfiles = api.nvim_get_vvar('oldfiles')
table.sort(oldfiles)
eq(2, #oldfiles)
eq(testfilename, oldfiles[1]:sub(-#testfilename))
@@ -159,8 +159,8 @@ describe('ShaDa support code', function()
nvim_command('quit')
nvim_command('rshada')
nvim_command('normal! \15') -- <C-o>
- eq(testfilename_2, funcs.bufname('%'))
- eq({ 2, 0 }, meths.nvim_win_get_cursor(0))
+ eq(testfilename_2, fn.bufname('%'))
+ eq({ 2, 0 }, api.nvim_win_get_cursor(0))
end)
it('is able to dump and restore jump list with different times (slow!)', function()
@@ -179,19 +179,19 @@ describe('ShaDa support code', function()
reset()
nvim_command('redraw')
nvim_command('edit ' .. testfilename)
- eq(testfilename, funcs.bufname('%'))
+ eq(testfilename, fn.bufname('%'))
eq(1, nvim_current_line())
nvim_command('execute "normal! \\<C-o>"')
- eq(testfilename, funcs.bufname('%'))
+ eq(testfilename, fn.bufname('%'))
eq(2, nvim_current_line())
nvim_command('execute "normal! \\<C-o>"')
- eq(testfilename_2, funcs.bufname('%'))
+ eq(testfilename_2, fn.bufname('%'))
eq(1, nvim_current_line())
nvim_command('execute "normal! \\<C-o>"')
- eq(testfilename_2, funcs.bufname('%'))
+ eq(testfilename_2, fn.bufname('%'))
eq(2, nvim_current_line())
nvim_command('execute "normal! \\<C-o>"')
- eq(testfilename_2, funcs.bufname('%'))
+ eq(testfilename_2, fn.bufname('%'))
eq(2, nvim_current_line())
end)
@@ -223,14 +223,14 @@ describe('ShaDa support code', function()
},
args = {
'-i',
- meths.nvim_get_var('tmpname'), -- Use same shada file as parent.
+ api.nvim_get_var('tmpname'), -- Use same shada file as parent.
'--cmd',
'silent edit ' .. non_existent_testfilename,
'-c',
'qall',
},
}
- eq('', funcs.system(argv))
+ eq('', fn.system(argv))
eq(0, exc_exec('rshada'))
end)
@@ -242,14 +242,14 @@ describe('ShaDa support code', function()
},
args = {
'-i',
- meths.nvim_get_var('tmpname'), -- Use same shada file as parent.
+ api.nvim_get_var('tmpname'), -- Use same shada file as parent.
'-c',
'silent edit ' .. non_existent_testfilename,
'-c',
'autocmd VimEnter * qall',
},
}
- eq('', funcs.system(argv))
+ eq('', fn.system(argv))
eq(0, exc_exec('rshada'))
end)
diff --git a/test/functional/shada/merging_spec.lua b/test/functional/shada/merging_spec.lua
index fd6bf9d7af..94e0ee6e82 100644
--- a/test/functional/shada/merging_spec.lua
+++ b/test/functional/shada/merging_spec.lua
@@ -1,8 +1,8 @@
-- ShaDa merging data support
local helpers = require('test.functional.helpers')(after_each)
-local nvim_command, funcs, eq = helpers.command, helpers.funcs, helpers.eq
+local nvim_command, fn, eq = helpers.command, helpers.fn, helpers.eq
local exc_exec, exec_capture = helpers.exc_exec, helpers.exec_capture
-local meths = helpers.meths
+local api = helpers.api
local shada_helpers = require('test.functional.shada.helpers')
local reset, clear, get_shada_rw =
@@ -138,7 +138,7 @@ describe('ShaDa history merging code', function()
eq(0, exc_exec('wshada! ' .. shada_fname))
local items = { 'ad', 'ab', 'ac', 'af', 'ae' }
for i, v in ipairs(items) do
- eq(v, funcs.histget(':', i))
+ eq(v, fn.histget(':', i))
end
local found = 0
for _, v in ipairs(read_shada_file(shada_fname)) do
@@ -239,7 +239,7 @@ describe('ShaDa search pattern support code', function()
eq(0, exc_exec(sdrcmd()))
wshada('\002\000\011\130\162sX\194\162sp\196\001?')
eq(0, exc_exec(sdrcmd()))
- eq('-', funcs.getreg('/'))
+ eq('-', fn.getreg('/'))
end)
it('uses last search pattern with gt tstamp from file when reading with bang', function()
@@ -247,7 +247,7 @@ describe('ShaDa search pattern support code', function()
eq(0, exc_exec(sdrcmd()))
wshada('\002\000\011\130\162sX\194\162sp\196\001?')
eq(0, exc_exec(sdrcmd(true)))
- eq('?', funcs.getreg('/'))
+ eq('?', fn.getreg('/'))
end)
it('uses last search pattern with eq timestamp from instance when reading', function()
@@ -255,7 +255,7 @@ describe('ShaDa search pattern support code', function()
eq(0, exc_exec(sdrcmd()))
wshada('\002\001\011\130\162sX\194\162sp\196\001?')
eq(0, exc_exec(sdrcmd()))
- eq('-', funcs.getreg('/'))
+ eq('-', fn.getreg('/'))
end)
it('uses last search pattern with gt timestamp from file when reading', function()
@@ -263,14 +263,14 @@ describe('ShaDa search pattern support code', function()
eq(0, exc_exec(sdrcmd()))
wshada('\002\002\011\130\162sX\194\162sp\196\001?')
eq(0, exc_exec(sdrcmd()))
- eq('?', funcs.getreg('/'))
+ eq('?', fn.getreg('/'))
end)
it('uses last search pattern with gt timestamp from instance when writing', function()
wshada('\002\001\011\130\162sX\194\162sp\196\001-')
eq(0, exc_exec(sdrcmd()))
wshada('\002\000\011\130\162sX\194\162sp\196\001?')
- eq('-', funcs.getreg('/'))
+ eq('-', fn.getreg('/'))
eq(0, exc_exec('wshada ' .. shada_fname))
local found = 0
for _, v in ipairs(read_shada_file(shada_fname)) do
@@ -285,7 +285,7 @@ describe('ShaDa search pattern support code', function()
wshada('\002\001\011\130\162sX\194\162sp\196\001-')
eq(0, exc_exec(sdrcmd()))
wshada('\002\001\011\130\162sX\194\162sp\196\001?')
- eq('-', funcs.getreg('/'))
+ eq('-', fn.getreg('/'))
eq(0, exc_exec('wshada ' .. shada_fname))
local found = 0
for _, v in ipairs(read_shada_file(shada_fname)) do
@@ -300,7 +300,7 @@ describe('ShaDa search pattern support code', function()
wshada('\002\001\011\130\162sX\194\162sp\196\001-')
eq(0, exc_exec(sdrcmd()))
wshada('\002\002\011\130\162sX\194\162sp\196\001?')
- eq('-', funcs.getreg('/'))
+ eq('-', fn.getreg('/'))
eq(0, exc_exec('wshada ' .. shada_fname))
local found = 0
for _, v in ipairs(read_shada_file(shada_fname)) do
@@ -316,7 +316,7 @@ describe('ShaDa search pattern support code', function()
eq(0, exc_exec(sdrcmd()))
wshada('\002\000\011\130\162ss\195\162sp\196\001?')
eq(0, exc_exec(sdrcmd()))
- eq('-', funcs.getreg('/'))
+ eq('-', fn.getreg('/'))
end)
it('uses last s/ pattern with gt timestamp from file when reading with !', function()
@@ -324,7 +324,7 @@ describe('ShaDa search pattern support code', function()
eq(0, exc_exec(sdrcmd()))
wshada('\002\000\011\130\162ss\195\162sp\196\001?')
eq(0, exc_exec(sdrcmd(true)))
- eq('?', funcs.getreg('/'))
+ eq('?', fn.getreg('/'))
end)
it('uses last s/ pattern with eq timestamp from instance when reading', function()
@@ -332,7 +332,7 @@ describe('ShaDa search pattern support code', function()
eq(0, exc_exec(sdrcmd()))
wshada('\002\001\011\130\162ss\195\162sp\196\001?')
eq(0, exc_exec(sdrcmd()))
- eq('-', funcs.getreg('/'))
+ eq('-', fn.getreg('/'))
end)
it('uses last s/ pattern with gt timestamp from file when reading', function()
@@ -340,14 +340,14 @@ describe('ShaDa search pattern support code', function()
eq(0, exc_exec(sdrcmd()))
wshada('\002\002\011\130\162ss\195\162sp\196\001?')
eq(0, exc_exec(sdrcmd()))
- eq('?', funcs.getreg('/'))
+ eq('?', fn.getreg('/'))
end)
it('uses last s/ pattern with gt timestamp from instance when writing', function()
wshada('\002\001\011\130\162ss\195\162sp\196\001-')
eq(0, exc_exec(sdrcmd()))
wshada('\002\000\011\130\162ss\195\162sp\196\001?')
- eq('-', funcs.getreg('/'))
+ eq('-', fn.getreg('/'))
eq(0, exc_exec('wshada ' .. shada_fname))
local found = 0
for _, v in ipairs(read_shada_file(shada_fname)) do
@@ -362,7 +362,7 @@ describe('ShaDa search pattern support code', function()
wshada('\002\001\011\130\162ss\195\162sp\196\001-')
eq(0, exc_exec(sdrcmd()))
wshada('\002\001\011\130\162ss\195\162sp\196\001?')
- eq('-', funcs.getreg('/'))
+ eq('-', fn.getreg('/'))
eq(0, exc_exec('wshada ' .. shada_fname))
local found = 0
for _, v in ipairs(read_shada_file(shada_fname)) do
@@ -377,7 +377,7 @@ describe('ShaDa search pattern support code', function()
wshada('\002\001\011\130\162ss\195\162sp\196\001-')
eq(0, exc_exec(sdrcmd()))
wshada('\002\002\011\130\162ss\195\162sp\196\001?')
- eq('-', funcs.getreg('/'))
+ eq('-', fn.getreg('/'))
eq(0, exc_exec('wshada ' .. shada_fname))
local found = 0
for _, v in ipairs(read_shada_file(shada_fname)) do
@@ -402,7 +402,7 @@ describe('ShaDa replacement string support code', function()
wshada('\003\000\004\145\196\001?')
eq(0, exc_exec(sdrcmd()))
nvim_command('s/.*/~')
- eq('-', funcs.getline('.'))
+ eq('-', fn.getline('.'))
nvim_command('bwipeout!')
end)
@@ -412,7 +412,7 @@ describe('ShaDa replacement string support code', function()
wshada('\003\000\004\145\196\001?')
eq(0, exc_exec(sdrcmd(true)))
nvim_command('s/.*/~')
- eq('?', funcs.getline('.'))
+ eq('?', fn.getline('.'))
nvim_command('bwipeout!')
end)
@@ -422,7 +422,7 @@ describe('ShaDa replacement string support code', function()
wshada('\003\001\004\145\196\001?')
eq(0, exc_exec(sdrcmd()))
nvim_command('s/.*/~')
- eq('-', funcs.getline('.'))
+ eq('-', fn.getline('.'))
nvim_command('bwipeout!')
end)
@@ -432,7 +432,7 @@ describe('ShaDa replacement string support code', function()
wshada('\003\002\004\145\196\001?')
eq(0, exc_exec(sdrcmd()))
nvim_command('s/.*/~')
- eq('?', funcs.getline('.'))
+ eq('?', fn.getline('.'))
nvim_command('bwipeout!')
end)
@@ -492,14 +492,14 @@ describe('ShaDa marks support code', function()
wshada('\007\000\018\131\162mX\195\161f\196\006' .. mock_file_path .. '?\161nA')
eq(0, exc_exec(sdrcmd()))
nvim_command('normal! `A')
- eq('-', funcs.fnamemodify(meths.nvim_buf_get_name(0), ':t'))
+ eq('-', fn.fnamemodify(api.nvim_buf_get_name(0), ':t'))
end)
it('can merge with file with mark 9 as the only numeric mark', function()
wshada('\007\001\014\130\161f\196\006' .. mock_file_path .. '-\161n9')
eq(0, exc_exec(sdrcmd()))
nvim_command('normal! `9oabc')
- eq('-', funcs.fnamemodify(meths.nvim_buf_get_name(0), ':t'))
+ eq('-', fn.fnamemodify(api.nvim_buf_get_name(0), ':t'))
eq(0, exc_exec('wshada ' .. shada_fname))
local found = {}
for _, v in ipairs(read_shada_file(shada_fname)) do
@@ -632,7 +632,7 @@ describe('ShaDa marks support code', function()
wshada('\007\000\018\131\162mX\195\161f\196\006' .. mock_file_path .. '?\161nA')
eq(0, exc_exec(sdrcmd(true)))
nvim_command('normal! `A')
- eq('?', funcs.fnamemodify(meths.nvim_buf_get_name(0), ':t'))
+ eq('?', fn.fnamemodify(api.nvim_buf_get_name(0), ':t'))
end)
it('uses last A mark with eq timestamp from instance when reading', function()
@@ -641,7 +641,7 @@ describe('ShaDa marks support code', function()
wshada('\007\001\018\131\162mX\195\161f\196\006' .. mock_file_path .. '?\161nA')
eq(0, exc_exec(sdrcmd()))
nvim_command('normal! `A')
- eq('-', funcs.fnamemodify(meths.nvim_buf_get_name(0), ':t'))
+ eq('-', fn.fnamemodify(api.nvim_buf_get_name(0), ':t'))
end)
it('uses last A mark with gt timestamp from file when reading', function()
@@ -650,7 +650,7 @@ describe('ShaDa marks support code', function()
wshada('\007\002\018\131\162mX\195\161f\196\006' .. mock_file_path .. '?\161nA')
eq(0, exc_exec(sdrcmd()))
nvim_command('normal! `A')
- eq('?', funcs.fnamemodify(meths.nvim_buf_get_name(0), ':t'))
+ eq('?', fn.fnamemodify(api.nvim_buf_get_name(0), ':t'))
end)
it('uses last A mark with gt timestamp from instance when writing', function()
@@ -658,7 +658,7 @@ describe('ShaDa marks support code', function()
eq(0, exc_exec(sdrcmd()))
wshada('\007\000\018\131\162mX\195\161f\196\006' .. mock_file_path .. '?\161nA')
nvim_command('normal! `A')
- eq('-', funcs.fnamemodify(meths.nvim_buf_get_name(0), ':t'))
+ eq('-', fn.fnamemodify(api.nvim_buf_get_name(0), ':t'))
eq(0, exc_exec('wshada ' .. shada_fname))
local found = {}
for _, v in ipairs(read_shada_file(shada_fname)) do
@@ -675,7 +675,7 @@ describe('ShaDa marks support code', function()
eq(0, exc_exec(sdrcmd()))
wshada('\007\001\018\131\162mX\195\161f\196\006' .. mock_file_path .. '?\161nA')
nvim_command('normal! `A')
- eq('-', funcs.fnamemodify(meths.nvim_buf_get_name(0), ':t'))
+ eq('-', fn.fnamemodify(api.nvim_buf_get_name(0), ':t'))
eq(0, exc_exec('wshada ' .. shada_fname))
local found = {}
for _, v in ipairs(read_shada_file(shada_fname)) do
@@ -692,7 +692,7 @@ describe('ShaDa marks support code', function()
eq(0, exc_exec(sdrcmd()))
wshada('\007\002\018\131\162mX\195\161f\196\006' .. mock_file_path .. '?\161nA')
nvim_command('normal! `A')
- eq('-', funcs.fnamemodify(meths.nvim_buf_get_name(0), ':t'))
+ eq('-', fn.fnamemodify(api.nvim_buf_get_name(0), ':t'))
eq(0, exc_exec('wshada ' .. shada_fname))
local found = {}
for _, v in ipairs(read_shada_file(shada_fname)) do
@@ -708,56 +708,56 @@ describe('ShaDa marks support code', function()
it('uses last a mark with gt timestamp from instance when reading', function()
nvim_command('edit ' .. mock_file_path .. '-')
- funcs.setline(1, { '-', '?' })
+ fn.setline(1, { '-', '?' })
wshada('\010\001\017\131\161l\001\161f\196\006' .. mock_file_path .. '-\161na')
eq(0, exc_exec(sdrcmd()))
wshada('\010\000\017\131\161l\002\161f\196\006' .. mock_file_path .. '-\161na')
eq(0, exc_exec(sdrcmd()))
nvim_command('normal! `a')
- eq('-', funcs.getline('.'))
+ eq('-', fn.getline('.'))
end)
it('uses last a mark with gt timestamp from file when reading with !', function()
nvim_command('edit ' .. mock_file_path .. '-')
- funcs.setline(1, { '-', '?' })
+ fn.setline(1, { '-', '?' })
wshada('\010\001\017\131\161l\001\161f\196\006' .. mock_file_path .. '-\161na')
eq(0, exc_exec(sdrcmd()))
wshada('\010\000\017\131\161l\002\161f\196\006' .. mock_file_path .. '-\161na')
eq(0, exc_exec(sdrcmd(true)))
nvim_command('normal! `a')
- eq('?', funcs.getline('.'))
+ eq('?', fn.getline('.'))
end)
it('uses last a mark with eq timestamp from instance when reading', function()
nvim_command('edit ' .. mock_file_path .. '-')
- funcs.setline(1, { '-', '?' })
+ fn.setline(1, { '-', '?' })
wshada('\010\001\017\131\161l\001\161f\196\006' .. mock_file_path .. '-\161na')
eq(0, exc_exec(sdrcmd()))
wshada('\010\001\017\131\161l\002\161f\196\006' .. mock_file_path .. '-\161na')
eq(0, exc_exec(sdrcmd()))
nvim_command('normal! `a')
- eq('-', funcs.getline('.'))
+ eq('-', fn.getline('.'))
end)
it('uses last a mark with gt timestamp from file when reading', function()
nvim_command('edit ' .. mock_file_path .. '-')
- funcs.setline(1, { '-', '?' })
+ fn.setline(1, { '-', '?' })
wshada('\010\001\017\131\161l\001\161f\196\006' .. mock_file_path .. '-\161na')
eq(0, exc_exec(sdrcmd()))
wshada('\010\002\017\131\161l\002\161f\196\006' .. mock_file_path .. '-\161na')
eq(0, exc_exec(sdrcmd()))
nvim_command('normal! `a')
- eq('?', funcs.getline('.'))
+ eq('?', fn.getline('.'))
end)
it('uses last a mark with gt timestamp from instance when writing', function()
nvim_command('edit ' .. mock_file_path .. '-')
- funcs.setline(1, { '-', '?' })
+ fn.setline(1, { '-', '?' })
wshada('\010\001\017\131\161l\001\161f\196\006' .. mock_file_path .. '-\161na')
eq(0, exc_exec(sdrcmd()))
wshada('\010\000\017\131\161l\002\161f\196\006' .. mock_file_path .. '-\161na')
nvim_command('normal! `a')
- eq('-', funcs.getline('.'))
+ eq('-', fn.getline('.'))
eq(0, exc_exec('wshada ' .. shada_fname))
local found = 0
for _, v in ipairs(read_shada_file(shada_fname)) do
@@ -775,12 +775,12 @@ describe('ShaDa marks support code', function()
it('uses last a mark with eq timestamp from instance when writing', function()
nvim_command('edit ' .. mock_file_path .. '-')
- funcs.setline(1, { '-', '?' })
+ fn.setline(1, { '-', '?' })
wshada('\010\001\017\131\161l\001\161f\196\006' .. mock_file_path .. '-\161na')
eq(0, exc_exec(sdrcmd()))
wshada('\010\001\017\131\161l\002\161f\196\006' .. mock_file_path .. '-\161na')
nvim_command('normal! `a')
- eq('-', funcs.getline('.'))
+ eq('-', fn.getline('.'))
eq(0, exc_exec('wshada ' .. shada_fname))
local found = 0
for _, v in ipairs(read_shada_file(shada_fname)) do
@@ -798,12 +798,12 @@ describe('ShaDa marks support code', function()
it('uses last a mark with gt timestamp from file when writing', function()
nvim_command('edit ' .. mock_file_path .. '-')
- funcs.setline(1, { '-', '?' })
+ fn.setline(1, { '-', '?' })
wshada('\010\001\017\131\161l\001\161f\196\006' .. mock_file_path .. '-\161na')
eq(0, exc_exec(sdrcmd()))
wshada('\010\002\017\131\161l\002\161f\196\006' .. mock_file_path .. '-\161na')
nvim_command('normal! `a')
- eq('-', funcs.fnamemodify(meths.nvim_buf_get_name(0), ':t'))
+ eq('-', fn.fnamemodify(api.nvim_buf_get_name(0), ':t'))
eq(0, exc_exec('wshada ' .. shada_fname))
local found = 0
for _, v in ipairs(read_shada_file(shada_fname)) do
@@ -832,7 +832,7 @@ describe('ShaDa registers support code', function()
eq(0, exc_exec(sdrcmd()))
wshada('\005\000\015\131\161na\162rX\194\162rc\145\196\001?')
eq(0, exc_exec(sdrcmd()))
- eq('-', funcs.getreg('a'))
+ eq('-', fn.getreg('a'))
end)
it('uses last a register with gt timestamp from file when reading with !', function()
@@ -840,7 +840,7 @@ describe('ShaDa registers support code', function()
eq(0, exc_exec(sdrcmd()))
wshada('\005\000\015\131\161na\162rX\194\162rc\145\196\001?')
eq(0, exc_exec(sdrcmd(true)))
- eq('?', funcs.getreg('a'))
+ eq('?', fn.getreg('a'))
end)
it('uses last a register with eq timestamp from instance when reading', function()
@@ -848,7 +848,7 @@ describe('ShaDa registers support code', function()
eq(0, exc_exec(sdrcmd()))
wshada('\005\001\015\131\161na\162rX\194\162rc\145\196\001?')
eq(0, exc_exec(sdrcmd()))
- eq('-', funcs.getreg('a'))
+ eq('-', fn.getreg('a'))
end)
it('uses last a register with gt timestamp from file when reading', function()
@@ -856,14 +856,14 @@ describe('ShaDa registers support code', function()
eq(0, exc_exec(sdrcmd()))
wshada('\005\002\015\131\161na\162rX\194\162rc\145\196\001?')
eq(0, exc_exec(sdrcmd()))
- eq('?', funcs.getreg('a'))
+ eq('?', fn.getreg('a'))
end)
it('uses last a register with gt timestamp from instance when writing', function()
wshada('\005\001\015\131\161na\162rX\194\162rc\145\196\001-')
eq(0, exc_exec(sdrcmd()))
wshada('\005\000\015\131\161na\162rX\194\162rc\145\196\001?')
- eq('-', funcs.getreg('a'))
+ eq('-', fn.getreg('a'))
eq(0, exc_exec('wshada ' .. shada_fname))
local found = 0
for _, v in ipairs(read_shada_file(shada_fname)) do
@@ -879,7 +879,7 @@ describe('ShaDa registers support code', function()
wshada('\005\001\015\131\161na\162rX\194\162rc\145\196\001-')
eq(0, exc_exec(sdrcmd()))
wshada('\005\001\015\131\161na\162rX\194\162rc\145\196\001?')
- eq('-', funcs.getreg('a'))
+ eq('-', fn.getreg('a'))
eq(0, exc_exec('wshada ' .. shada_fname))
local found = 0
for _, v in ipairs(read_shada_file(shada_fname)) do
@@ -895,7 +895,7 @@ describe('ShaDa registers support code', function()
wshada('\005\001\015\131\161na\162rX\194\162rc\145\196\001-')
eq(0, exc_exec(sdrcmd()))
wshada('\005\002\015\131\161na\162rX\194\162rc\145\196\001?')
- eq('-', funcs.getreg('a'))
+ eq('-', fn.getreg('a'))
eq(0, exc_exec('wshada ' .. shada_fname))
local found = 0
for _, v in ipairs(read_shada_file(shada_fname)) do
@@ -940,7 +940,7 @@ describe('ShaDa jumps support code', function()
.. 'f\161l\002'
)
eq(0, exc_exec(sdrcmd()))
- eq('', meths.nvim_buf_get_name(0))
+ eq('', api.nvim_buf_get_name(0))
eq(
' jump line col file/text\n'
.. ' 5 2 0 '
diff --git a/test/functional/shada/registers_spec.lua b/test/functional/shada/registers_spec.lua
index ceb3ddf2fe..ef15ab9a05 100644
--- a/test/functional/shada/registers_spec.lua
+++ b/test/functional/shada/registers_spec.lua
@@ -1,6 +1,6 @@
-- ShaDa registers saving/reading support
local helpers = require('test.functional.helpers')(after_each)
-local nvim_command, funcs, eq = helpers.command, helpers.funcs, helpers.eq
+local nvim_command, fn, eq = helpers.command, helpers.fn, helpers.eq
local shada_helpers = require('test.functional.shada.helpers')
local reset, clear = shada_helpers.reset, shada_helpers.clear
@@ -10,13 +10,13 @@ local setreg = function(name, contents, typ)
if type(contents) == 'string' then
contents = { contents }
end
- funcs.setreg(name, contents, typ)
+ fn.setreg(name, contents, typ)
end
local getreg = function(name)
return {
- funcs.getreg(name, 1, 1),
- funcs.getregtype(name),
+ fn.getreg(name, 1, 1),
+ fn.getregtype(name),
}
end
diff --git a/test/functional/shada/shada_spec.lua b/test/functional/shada/shada_spec.lua
index b16a19ef31..2942beab2f 100644
--- a/test/functional/shada/shada_spec.lua
+++ b/test/functional/shada/shada_spec.lua
@@ -1,6 +1,6 @@
-- Other ShaDa tests
local helpers = require('test.functional.helpers')(after_each)
-local meths, nvim_command, funcs, eq = helpers.meths, helpers.command, helpers.funcs, helpers.eq
+local api, nvim_command, fn, eq = helpers.api, helpers.command, helpers.fn, helpers.eq
local write_file, spawn, set_session, nvim_prog, exc_exec =
helpers.write_file, helpers.spawn, helpers.set_session, helpers.nvim_prog, helpers.exc_exec
local is_os = helpers.is_os
@@ -57,8 +57,8 @@ describe('ShaDa support code', function()
local hist1 = ('-'):rep(1024 - 5)
local hist2 = ('-'):rep(1025 - 5)
nvim_command('set shada-=s10 shada+=s1')
- funcs.histadd(':', hist1)
- funcs.histadd(':', hist2)
+ fn.histadd(':', hist1)
+ fn.histadd(':', hist2)
eq(0, exc_exec('wshada ' .. shada_fname))
local found = 0
for _, v in ipairs(read_shada_file(shada_fname)) do
@@ -175,7 +175,7 @@ describe('ShaDa support code', function()
it('correctly uses shada-r option', function()
nvim_command('set shellslash')
- meths.nvim_set_var('__home', paths.test_source_path)
+ api.nvim_set_var('__home', paths.test_source_path)
nvim_command('let $HOME = __home')
nvim_command('unlet __home')
nvim_command('edit ~/README.md')
@@ -183,7 +183,7 @@ describe('ShaDa support code', function()
nvim_command('undo')
nvim_command('set shada+=%')
nvim_command('wshada! ' .. shada_fname)
- local readme_fname = funcs.resolve(paths.test_source_path) .. '/README.md'
+ local readme_fname = fn.resolve(paths.test_source_path) .. '/README.md'
eq({ [7] = 2, [8] = 2, [9] = 1, [10] = 4, [11] = 1 }, find_file(readme_fname))
nvim_command('set shada+=r~')
nvim_command('wshada! ' .. shada_fname)
@@ -191,21 +191,19 @@ describe('ShaDa support code', function()
nvim_command('set shada-=r~')
nvim_command('wshada! ' .. shada_fname)
eq({ [7] = 2, [8] = 2, [9] = 1, [10] = 4, [11] = 1 }, find_file(readme_fname))
- nvim_command(
- 'set shada+=r' .. funcs.escape(funcs.escape(paths.test_source_path, '$~'), ' "\\,')
- )
+ nvim_command('set shada+=r' .. fn.escape(fn.escape(paths.test_source_path, '$~'), ' "\\,'))
nvim_command('wshada! ' .. shada_fname)
eq({}, find_file(readme_fname))
end)
it('correctly ignores case with shada-r option', function()
nvim_command('set shellslash')
- local pwd = funcs.getcwd()
+ local pwd = fn.getcwd()
local relfname = 'абв/test'
local fname = pwd .. '/' .. relfname
- meths.nvim_set_var('__fname', fname)
+ api.nvim_set_var('__fname', fname)
nvim_command('silent! edit `=__fname`')
- funcs.setline(1, { 'a', 'b', 'c', 'd' })
+ fn.setline(1, { 'a', 'b', 'c', 'd' })
nvim_command('normal! GmAggmaAabc')
nvim_command('undo')
nvim_command('set shada+=%')
@@ -217,30 +215,30 @@ describe('ShaDa support code', function()
end)
it('is able to set &shada after &viminfo', function()
- 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', {}))
+ api.nvim_set_option_value('viminfo', "'10", {})
+ eq("'10", api.nvim_get_option_value('viminfo', {}))
+ eq("'10", api.nvim_get_option_value('shada', {}))
+ api.nvim_set_option_value('shada', '', {})
+ eq('', api.nvim_get_option_value('viminfo', {}))
+ eq('', api.nvim_get_option_value('shada', {}))
end)
it('is able to set all& after setting &shada', function()
- meths.nvim_set_option_value('shada', "'10", {})
- eq("'10", meths.nvim_get_option_value('viminfo', {}))
- eq("'10", meths.nvim_get_option_value('shada', {}))
+ api.nvim_set_option_value('shada', "'10", {})
+ eq("'10", api.nvim_get_option_value('viminfo', {}))
+ eq("'10", api.nvim_get_option_value('shada', {}))
nvim_command('set all&')
- eq("!,'100,<50,s10,h", meths.nvim_get_option_value('viminfo', {}))
- eq("!,'100,<50,s10,h", meths.nvim_get_option_value('shada', {}))
+ eq("!,'100,<50,s10,h", api.nvim_get_option_value('viminfo', {}))
+ eq("!,'100,<50,s10,h", api.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.nvim_get_option_value('viminfo', {}))
- eq("'10", meths.nvim_get_option_value('shada', {}))
+ eq("'10", api.nvim_get_option_value('viminfo', {}))
+ eq("'10", api.nvim_get_option_value('shada', {}))
nvim_command('set shada=')
- eq('', meths.nvim_get_option_value('viminfo', {}))
- eq('', meths.nvim_get_option_value('shada', {}))
+ eq('', api.nvim_get_option_value('viminfo', {}))
+ eq('', api.nvim_get_option_value('shada', {}))
end)
it('setting &shada gives proper error message on missing number', function()
@@ -256,17 +254,17 @@ describe('ShaDa support code', function()
it('does not crash when ShaDa file directory is not writable', function()
skip(is_os('win'))
- funcs.mkdir(dirname, '', 0)
- eq(0, funcs.filewritable(dirname))
+ fn.mkdir(dirname, '', 0)
+ eq(0, fn.filewritable(dirname))
reset { shadafile = dirshada, args = { '--cmd', 'set shada=' } }
- meths.nvim_set_option_value('shada', "'10", {})
+ api.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.nvim_set_option_value('shada', '', {})
+ api.nvim_set_option_value('shada', '', {})
end)
end)
@@ -285,7 +283,7 @@ describe('ShaDa support code', function()
write_file('NONE', '\005\001\015\131\161na\162rX\194\162rc\145\196\001-')
local session = spawn({ nvim_prog, '-u', 'NONE', '-i', 'NONE', '--embed', '--headless' }, true)
set_session(session)
- eq('', funcs.getreg('a'))
+ eq('', fn.getreg('a'))
session:close()
os.remove('NONE')
end)
diff --git a/test/functional/shada/variables_spec.lua b/test/functional/shada/variables_spec.lua
index 6096c72bcb..d70f5deded 100644
--- a/test/functional/shada/variables_spec.lua
+++ b/test/functional/shada/variables_spec.lua
@@ -1,7 +1,7 @@
-- ShaDa variables saving/reading support
local helpers = require('test.functional.helpers')(after_each)
-local meths, funcs, nvim_command, eq, eval =
- helpers.meths, helpers.funcs, helpers.command, helpers.eq, helpers.eval
+local api, fn, nvim_command, eq, eval =
+ helpers.api, helpers.fn, helpers.command, helpers.eq, helpers.eval
local expect_exit = helpers.expect_exit
local shada_helpers = require('test.functional.shada.helpers')
@@ -12,13 +12,13 @@ describe('ShaDa support code', function()
after_each(clear)
it('is able to dump and read back string variable', function()
- meths.nvim_set_var('STRVAR', 'foo')
+ api.nvim_set_var('STRVAR', 'foo')
nvim_command('set shada+=!')
nvim_command('wshada')
reset()
nvim_command('set shada+=!')
nvim_command('rshada')
- eq('foo', meths.nvim_get_var('STRVAR'))
+ eq('foo', api.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.nvim_get_var(varname)
+ varval = api.nvim_get_var(varname)
else
- meths.nvim_set_var(varname, varval)
+ api.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.nvim_get_var(varname))
+ eq(varval, api.nvim_get_var(varname))
end)
end
@@ -53,113 +53,110 @@ describe('ShaDa support code', function()
autotest('blob (with NULs)', 'BLOBVARNULS', '0z004e554c7300', true)
it('does not read back variables without `!` in &shada', function()
- meths.nvim_set_var('STRVAR', 'foo')
+ api.nvim_set_var('STRVAR', 'foo')
nvim_command('set shada+=!')
nvim_command('wshada')
reset('set shada-=!')
nvim_command('rshada')
- eq(0, funcs.exists('g:STRVAR'))
+ eq(0, fn.exists('g:STRVAR'))
end)
it('does not dump variables without `!` in &shada', function()
nvim_command('set shada-=!')
- meths.nvim_set_var('STRVAR', 'foo')
+ api.nvim_set_var('STRVAR', 'foo')
nvim_command('wshada')
reset()
nvim_command('set shada+=!')
nvim_command('rshada')
- eq(0, funcs.exists('g:STRVAR'))
+ eq(0, fn.exists('g:STRVAR'))
end)
it('does not dump session variables', function()
nvim_command('set shada+=!')
- meths.nvim_set_var('StrVar', 'foo')
+ api.nvim_set_var('StrVar', 'foo')
nvim_command('wshada')
reset()
nvim_command('set shada+=!')
nvim_command('rshada')
- eq(0, funcs.exists('g:StrVar'))
+ eq(0, fn.exists('g:StrVar'))
end)
it('does not dump regular variables', function()
nvim_command('set shada+=!')
- meths.nvim_set_var('str_var', 'foo')
+ api.nvim_set_var('str_var', 'foo')
nvim_command('wshada')
reset()
nvim_command('set shada+=!')
nvim_command('rshada')
- eq(0, funcs.exists('g:str_var'))
+ eq(0, fn.exists('g:str_var'))
end)
it('dumps and loads variables correctly with utf-8 strings', function()
reset()
- meths.nvim_set_var('STRVAR', '«')
- meths.nvim_set_var('LSTVAR', { '«' })
- meths.nvim_set_var('DCTVAR', { ['«'] = '«' })
- meths.nvim_set_var('NESTEDVAR', { ['«'] = { { '«' }, { ['«'] = '«' }, { a = 'Test' } } })
+ api.nvim_set_var('STRVAR', '«')
+ api.nvim_set_var('LSTVAR', { '«' })
+ api.nvim_set_var('DCTVAR', { ['«'] = '«' })
+ api.nvim_set_var('NESTEDVAR', { ['«'] = { { '«' }, { ['«'] = '«' }, { a = 'Test' } } })
expect_exit(nvim_command, 'qall')
reset()
- 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')
- )
+ eq('«', api.nvim_get_var('STRVAR'))
+ eq({ '«' }, api.nvim_get_var('LSTVAR'))
+ eq({ ['«'] = '«' }, api.nvim_get_var('DCTVAR'))
+ eq({ ['«'] = { { '«' }, { ['«'] = '«' }, { a = 'Test' } } }, api.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.nvim_set_var('STRVAR', '\171')
- meths.nvim_set_var('LSTVAR', { '\171' })
- meths.nvim_set_var('DCTVAR', { ['«\171'] = '«\171' })
- meths.nvim_set_var(
+ api.nvim_set_var('STRVAR', '\171')
+ api.nvim_set_var('LSTVAR', { '\171' })
+ api.nvim_set_var('DCTVAR', { ['«\171'] = '«\171' })
+ api.nvim_set_var(
'NESTEDVAR',
{ ['\171'] = { { '\171«' }, { ['\171'] = '\171' }, { a = 'Test' } } }
)
expect_exit(nvim_command, 'qall')
reset()
- eq('\171', meths.nvim_get_var('STRVAR'))
- eq({ '\171' }, meths.nvim_get_var('LSTVAR'))
- eq({ ['«\171'] = '«\171' }, meths.nvim_get_var('DCTVAR'))
+ eq('\171', api.nvim_get_var('STRVAR'))
+ eq({ '\171' }, api.nvim_get_var('LSTVAR'))
+ eq({ ['«\171'] = '«\171' }, api.nvim_get_var('DCTVAR'))
eq(
{ ['\171'] = { { '\171«' }, { ['\171'] = '\171' }, { a = 'Test' } } },
- meths.nvim_get_var('NESTEDVAR')
+ api.nvim_get_var('NESTEDVAR')
)
end)
it('ignore when a funcref is stored in a variable', function()
nvim_command('let F = function("tr")')
- meths.nvim_set_var('U', '10')
+ api.nvim_set_var('U', '10')
nvim_command('set shada+=!')
nvim_command('wshada')
reset()
nvim_command('set shada+=!')
nvim_command('rshada')
- eq('10', meths.nvim_get_var('U'))
+ eq('10', api.nvim_get_var('U'))
end)
it('ignore when a partial is stored in a variable', function()
nvim_command('let P = { -> 1 }')
- meths.nvim_set_var('U', '10')
+ api.nvim_set_var('U', '10')
nvim_command('set shada+=!')
nvim_command('wshada')
reset()
nvim_command('set shada+=!')
nvim_command('rshada')
- eq('10', meths.nvim_get_var('U'))
+ eq('10', api.nvim_get_var('U'))
end)
it('ignore when a self-referencing list is stored in a variable', function()
- meths.nvim_set_var('L', {})
+ api.nvim_set_var('L', {})
nvim_command('call add(L, L)')
- meths.nvim_set_var('U', '10')
+ api.nvim_set_var('U', '10')
nvim_command('set shada+=!')
nvim_command('wshada')
reset()
nvim_command('rshada')
- eq('10', meths.nvim_get_var('U'))
+ eq('10', api.nvim_get_var('U'))
end)
end)