diff options
Diffstat (limited to 'test/functional/shada/merging_spec.lua')
-rw-r--r-- | test/functional/shada/merging_spec.lua | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/test/functional/shada/merging_spec.lua b/test/functional/shada/merging_spec.lua index 7ca261eb11..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, curbufmeths, eq = - helpers.command, helpers.funcs, helpers.curbufmeths, 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 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(curbufmeths.get_name(), ':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(curbufmeths.get_name(), ':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(curbufmeths.get_name(), ':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(curbufmeths.get_name(), ':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(curbufmeths.get_name(), ':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(curbufmeths.get_name(), ':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(curbufmeths.get_name(), ':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(curbufmeths.get_name(), ':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(curbufmeths.get_name(), ':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('', curbufmeths.get_name()) + eq('', api.nvim_buf_get_name(0)) eq( ' jump line col file/text\n' .. ' 5 2 0 ' |