diff options
| author | Lewis Russell <lewis6991@gmail.com> | 2024-01-12 13:11:28 +0000 |
|---|---|---|
| committer | Lewis Russell <lewis6991@gmail.com> | 2024-01-12 17:53:27 +0000 |
| commit | 4f81f506f96f8b5bfcf00e952ceb492d3ce9dc6e (patch) | |
| tree | 0cbb2cf8dac8b4f43109dc6f7a4051dfbea23f12 /test/functional/shada | |
| parent | c30f2e3182e3b50e7c03932027ac55edfc8ada4a (diff) | |
| download | rneovim-4f81f506f96f8b5bfcf00e952ceb492d3ce9dc6e.tar.gz rneovim-4f81f506f96f8b5bfcf00e952ceb492d3ce9dc6e.tar.bz2 rneovim-4f81f506f96f8b5bfcf00e952ceb492d3ce9dc6e.zip | |
test: normalise nvim bridge functions
- remove helpers.cur*meths
- remove helpers.nvim
Diffstat (limited to 'test/functional/shada')
| -rw-r--r-- | test/functional/shada/buffers_spec.lua | 7 | ||||
| -rw-r--r-- | test/functional/shada/marks_spec.lua | 22 | ||||
| -rw-r--r-- | test/functional/shada/merging_spec.lua | 24 |
3 files changed, 23 insertions, 30 deletions
diff --git a/test/functional/shada/buffers_spec.lua b/test/functional/shada/buffers_spec.lua index c0fb3815b6..06b7167525 100644 --- a/test/functional/shada/buffers_spec.lua +++ b/test/functional/shada/buffers_spec.lua @@ -1,7 +1,6 @@ -- shada buffer list saving/reading support local helpers = require('test.functional.helpers')(after_each) -local nvim_command, funcs, eq, curbufmeths, meths = - helpers.command, helpers.funcs, helpers.eq, helpers.curbufmeths, helpers.meths +local nvim_command, funcs, eq, meths = helpers.command, helpers.funcs, helpers.eq, helpers.meths local expect_exit = helpers.expect_exit local shada_helpers = require('test.functional.shada.helpers') @@ -70,9 +69,9 @@ describe('shada support code', function() it('does not dump unnamed buffers', function() reset('set shada+=% hidden') - curbufmeths.set_lines(0, 1, true, { 'foo' }) + meths.nvim_buf_set_lines(0, 0, 1, true, { 'foo' }) nvim_command('enew') - curbufmeths.set_lines(0, 1, true, { 'bar' }) + meths.nvim_buf_set_lines(0, 0, 1, true, { 'bar' }) eq(2, funcs.bufnr('$')) expect_exit(nvim_command, 'qall!') reset('set shada+=% hidden') diff --git a/test/functional/shada/marks_spec.lua b/test/functional/shada/marks_spec.lua index b50df23be4..0850084d98 100644 --- a/test/functional/shada/marks_spec.lua +++ b/test/functional/shada/marks_spec.lua @@ -1,12 +1,6 @@ -- ShaDa marks saving/reading support local helpers = require('test.functional.helpers')(after_each) -local meths, curwinmeths, curbufmeths, nvim_command, funcs, eq = - helpers.meths, - helpers.curwinmeths, - helpers.curbufmeths, - helpers.command, - helpers.funcs, - helpers.eq +local meths, nvim_command, funcs, eq = helpers.meths, helpers.command, helpers.funcs, helpers.eq local feed = helpers.feed local exc_exec, exec_capture = helpers.exc_exec, helpers.exec_capture local expect_exit = helpers.expect_exit @@ -15,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 curwinmeths.get_cursor()[1] + return meths.nvim_win_get_cursor(0)[1] end describe('ShaDa support code', function() @@ -49,7 +43,7 @@ describe('ShaDa support code', function() reset() nvim_command('rshada') nvim_command('normal! `A') - eq(testfilename, funcs.fnamemodify(curbufmeths.get_name(), ':t')) + eq(testfilename, funcs.fnamemodify(meths.nvim_buf_get_name(0), ':t')) eq(1, nvim_current_line()) nvim_command('normal! `B') eq(2, nvim_current_line()) @@ -76,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(curbufmeths.get_name(), ':t')) + eq(testfilename, funcs.fnamemodify(meths.nvim_buf_get_name(0), ':t')) eq(1, nvim_current_line()) end) @@ -89,7 +83,7 @@ describe('ShaDa support code', function() reset() nvim_command('edit ' .. testfilename) nvim_command('normal! `a') - eq(testfilename, funcs.fnamemodify(curbufmeths.get_name(), ':t')) + eq(testfilename, funcs.fnamemodify(meths.nvim_buf_get_name(0), ':t')) eq(1, nvim_current_line()) nvim_command('normal! `b') eq(2, nvim_current_line()) @@ -119,9 +113,9 @@ describe('ShaDa support code', function() it('is able to populate v:oldfiles', function() nvim_command('edit ' .. testfilename) - local tf_full = curbufmeths.get_name() + local tf_full = meths.nvim_buf_get_name(0) nvim_command('edit ' .. testfilename_2) - local tf_full_2 = curbufmeths.get_name() + local tf_full_2 = meths.nvim_buf_get_name(0) expect_exit(nvim_command, 'qall') reset() local oldfiles = meths.nvim_get_vvar('oldfiles') @@ -166,7 +160,7 @@ describe('ShaDa support code', function() nvim_command('rshada') nvim_command('normal! \15') -- <C-o> eq(testfilename_2, funcs.bufname('%')) - eq({ 2, 0 }, curwinmeths.get_cursor()) + eq({ 2, 0 }, meths.nvim_win_get_cursor(0)) end) it('is able to dump and restore jump list with different times (slow!)', function() diff --git a/test/functional/shada/merging_spec.lua b/test/functional/shada/merging_spec.lua index 7ca261eb11..fd6bf9d7af 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, curbufmeths, eq = - helpers.command, helpers.funcs, helpers.curbufmeths, helpers.eq +local nvim_command, funcs, eq = helpers.command, helpers.funcs, helpers.eq local exc_exec, exec_capture = helpers.exc_exec, helpers.exec_capture +local meths = helpers.meths local shada_helpers = require('test.functional.shada.helpers') local reset, clear, get_shada_rw = @@ -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(curbufmeths.get_name(), ':t')) + eq('-', funcs.fnamemodify(meths.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(curbufmeths.get_name(), ':t')) + eq('-', funcs.fnamemodify(meths.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(curbufmeths.get_name(), ':t')) + eq('?', funcs.fnamemodify(meths.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(curbufmeths.get_name(), ':t')) + eq('-', funcs.fnamemodify(meths.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(curbufmeths.get_name(), ':t')) + eq('?', funcs.fnamemodify(meths.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(curbufmeths.get_name(), ':t')) + eq('-', funcs.fnamemodify(meths.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(curbufmeths.get_name(), ':t')) + eq('-', funcs.fnamemodify(meths.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(curbufmeths.get_name(), ':t')) + eq('-', funcs.fnamemodify(meths.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 @@ -803,7 +803,7 @@ describe('ShaDa marks support code', function() 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(curbufmeths.get_name(), ':t')) + eq('-', funcs.fnamemodify(meths.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 @@ -940,7 +940,7 @@ describe('ShaDa jumps support code', function() .. 'f\161l\002' ) eq(0, exc_exec(sdrcmd())) - eq('', curbufmeths.get_name()) + eq('', meths.nvim_buf_get_name(0)) eq( ' jump line col file/text\n' .. ' 5 2 0 ' |