2015-07-26 10:46:40 -07:00
|
|
|
-- ShaDa compatibility support
|
2016-04-23 16:53:11 -07:00
|
|
|
local helpers = require('test.functional.helpers')(after_each)
|
2024-01-12 10:59:57 -07:00
|
|
|
local nvim_command, fn, eq = helpers.command, helpers.fn, helpers.eq
|
2015-09-19 10:57:49 -07:00
|
|
|
local exc_exec = helpers.exc_exec
|
2015-07-26 10:46:40 -07:00
|
|
|
|
|
|
|
local shada_helpers = require('test.functional.shada.helpers')
|
2015-11-17 14:44:00 -07:00
|
|
|
local reset, clear, get_shada_rw =
|
|
|
|
shada_helpers.reset, shada_helpers.clear, shada_helpers.get_shada_rw
|
2015-08-09 08:41:25 -07:00
|
|
|
local read_shada_file = shada_helpers.read_shada_file
|
2015-07-26 10:46:40 -07:00
|
|
|
|
2015-08-08 04:54:47 -07:00
|
|
|
local wshada, sdrcmd, shada_fname = get_shada_rw('Xtest-functional-shada-compatibility.shada')
|
2015-07-26 10:46:40 -07:00
|
|
|
|
2017-09-21 06:50:56 -07:00
|
|
|
local mock_file_path = '/a/b/'
|
|
|
|
local mock_file_path2 = '/d/e/'
|
2022-11-21 17:13:30 -07:00
|
|
|
if helpers.is_os('win') then
|
2017-09-21 06:50:56 -07:00
|
|
|
mock_file_path = 'C:/a/'
|
|
|
|
mock_file_path2 = 'C:/d/'
|
|
|
|
end
|
|
|
|
|
2015-07-26 10:46:40 -07:00
|
|
|
describe('ShaDa forward compatibility support code', function()
|
|
|
|
before_each(reset)
|
|
|
|
after_each(function()
|
|
|
|
clear()
|
|
|
|
os.remove(shada_fname)
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('works with search pattern item with BOOL unknown (sX) key value', function()
|
|
|
|
wshada('\002\001\011\130\162sX\194\162sp\196\001-')
|
|
|
|
eq(0, exc_exec(sdrcmd()))
|
|
|
|
os.remove(shada_fname)
|
|
|
|
nvim_command('wshada ' .. shada_fname)
|
|
|
|
local found = false
|
|
|
|
for _, v in ipairs(read_shada_file(shada_fname)) do
|
|
|
|
if v.type == 2 and not v.value.ss then
|
|
|
|
eq(false, v.value.sX)
|
|
|
|
found = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(true, found)
|
|
|
|
eq(0, exc_exec(sdrcmd()))
|
|
|
|
os.remove(shada_fname)
|
|
|
|
nvim_command('silent! /---/')
|
|
|
|
nvim_command('wshada ' .. shada_fname)
|
|
|
|
found = false
|
|
|
|
for _, v in ipairs(read_shada_file(shada_fname)) do
|
2015-08-23 09:58:56 -07:00
|
|
|
if v.type == 2 and not v.value.ss then
|
2015-07-26 10:46:40 -07:00
|
|
|
eq(nil, v.value.sX)
|
|
|
|
found = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(true, found)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-08-15 07:20:07 -07:00
|
|
|
nvim_command('rshada! ' .. shada_fname)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-07-26 10:46:40 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('works with s/search pattern item with BOOL unknown (sX) key value', function()
|
|
|
|
wshada('\002\001\015\131\162sX\194\162ss\195\162sp\196\001-')
|
|
|
|
eq(0, exc_exec(sdrcmd()))
|
|
|
|
os.remove(shada_fname)
|
|
|
|
nvim_command('wshada ' .. shada_fname)
|
|
|
|
local found = false
|
|
|
|
for _, v in ipairs(read_shada_file(shada_fname)) do
|
|
|
|
if v.type == 2 and v.value.ss then
|
|
|
|
eq(false, v.value.sX)
|
|
|
|
found = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(true, found)
|
|
|
|
eq(0, exc_exec(sdrcmd()))
|
|
|
|
os.remove(shada_fname)
|
|
|
|
nvim_command('silent! s/--/---/ge')
|
|
|
|
nvim_command('wshada ' .. shada_fname)
|
|
|
|
found = false
|
|
|
|
for _, v in ipairs(read_shada_file(shada_fname)) do
|
|
|
|
if v.type == 2 and v.value.ss then
|
|
|
|
eq(nil, v.value.sX)
|
|
|
|
found = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(true, found)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-08-15 07:20:07 -07:00
|
|
|
nvim_command('rshada!' .. shada_fname)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-07-26 10:46:40 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('works with replacement item with BOOL additional value in list', function()
|
|
|
|
wshada('\003\000\005\146\196\001-\194')
|
|
|
|
eq(0, exc_exec(sdrcmd()))
|
|
|
|
os.remove(shada_fname)
|
|
|
|
nvim_command('wshada ' .. shada_fname)
|
|
|
|
local found = false
|
|
|
|
for _, v in ipairs(read_shada_file(shada_fname)) do
|
|
|
|
if v.type == 3 then
|
|
|
|
eq(2, #v.value)
|
|
|
|
eq(false, v.value[2])
|
|
|
|
found = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(true, found)
|
|
|
|
eq(0, exc_exec(sdrcmd()))
|
|
|
|
os.remove(shada_fname)
|
|
|
|
nvim_command('silent! s/--/---/ge')
|
|
|
|
nvim_command('wshada ' .. shada_fname)
|
|
|
|
found = false
|
|
|
|
for _, v in ipairs(read_shada_file(shada_fname)) do
|
|
|
|
if v.type == 3 then
|
|
|
|
eq(1, #v.value)
|
|
|
|
found = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(true, found)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-08-15 07:20:07 -07:00
|
|
|
nvim_command('rshada!' .. shada_fname)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-07-26 10:46:40 -07:00
|
|
|
end)
|
|
|
|
|
2017-09-21 06:50:56 -07:00
|
|
|
for _, v in ipairs({
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2017-09-21 06:50:56 -07:00
|
|
|
name = 'global mark',
|
|
|
|
mpack = '\007\001\018\131\162mX\195\161f\196\006' .. mock_file_path .. 'c\161nA',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name = 'jump',
|
|
|
|
mpack = '\008\001\018\131\162mX\195\161f\196\006' .. mock_file_path .. 'c\161l\002',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name = 'local mark',
|
|
|
|
mpack = '\010\001\018\131\162mX\195\161f\196\006' .. mock_file_path .. 'c\161na',
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
2017-09-21 06:50:56 -07:00
|
|
|
{ name = 'change', mpack = '\011\001\015\130\162mX\195\161f\196\006' .. mock_file_path .. 'c' },
|
2015-07-26 10:46:40 -07:00
|
|
|
}) do
|
|
|
|
it('works with ' .. v.name .. ' item with BOOL unknown (mX) key value', function()
|
2017-09-21 06:50:56 -07:00
|
|
|
nvim_command('silent noautocmd edit ' .. mock_file_path .. 'c')
|
2024-01-12 10:59:57 -07:00
|
|
|
eq('' .. mock_file_path .. 'c', fn.bufname('%'))
|
|
|
|
fn.setline('.', { '1', '2', '3' })
|
2015-07-26 10:46:40 -07:00
|
|
|
wshada(v.mpack)
|
|
|
|
eq(0, exc_exec(sdrcmd(true)))
|
|
|
|
os.remove(shada_fname)
|
|
|
|
nvim_command('wshada ' .. shada_fname)
|
|
|
|
local found = false
|
|
|
|
for _, subv in ipairs(read_shada_file(shada_fname)) do
|
|
|
|
if subv.type == v.mpack:byte() then
|
|
|
|
if subv.value.mX == true then
|
|
|
|
found = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(true, found)
|
|
|
|
eq(0, exc_exec(sdrcmd()))
|
|
|
|
nvim_command('bwipeout!')
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.setpos("'A", { 0, 1, 1, 0 })
|
2015-07-26 10:46:40 -07:00
|
|
|
os.remove(shada_fname)
|
|
|
|
nvim_command('wshada ' .. shada_fname)
|
|
|
|
found = false
|
|
|
|
for _, subv in ipairs(read_shada_file(shada_fname)) do
|
|
|
|
if subv.type == v.mpack:byte() then
|
|
|
|
if subv.value.mX == true then
|
|
|
|
found = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(false, found)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-08-15 07:20:07 -07:00
|
|
|
nvim_command('rshada!' .. shada_fname)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-07-26 10:46:40 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
if v.name == 'global mark' or v.name == 'local mark' then
|
|
|
|
it('works with ' .. v.name .. ' item with <C-a> name', function()
|
2017-09-21 06:50:56 -07:00
|
|
|
nvim_command('silent noautocmd edit ' .. mock_file_path .. 'c')
|
2024-01-12 10:59:57 -07:00
|
|
|
eq('' .. mock_file_path .. 'c', fn.bufname('%'))
|
|
|
|
fn.setline('.', { '1', '2', '3' })
|
2015-07-26 10:46:40 -07:00
|
|
|
wshada(
|
|
|
|
v.mpack:gsub('n.$', 'n\001')
|
|
|
|
.. v.mpack:gsub('n.$', 'n\002')
|
2017-09-21 06:50:56 -07:00
|
|
|
.. v.mpack
|
|
|
|
:gsub('n.$', 'n\003')
|
|
|
|
:gsub('' .. mock_file_path .. 'c', '' .. mock_file_path2 .. 'f')
|
2024-01-02 18:09:18 -07:00
|
|
|
)
|
2015-07-26 10:46:40 -07:00
|
|
|
eq(0, exc_exec(sdrcmd(true)))
|
|
|
|
nvim_command('wshada ' .. shada_fname)
|
|
|
|
local found = 0
|
|
|
|
for i, subv in ipairs(read_shada_file(shada_fname)) do
|
|
|
|
if i == 1 then
|
|
|
|
eq(1, subv.type)
|
|
|
|
end
|
|
|
|
if subv.type == v.mpack:byte() then
|
|
|
|
if subv.value.mX == true and subv.value.n <= 3 then
|
|
|
|
found = found + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(3, found)
|
|
|
|
nvim_command('wshada! ' .. shada_fname)
|
2015-11-17 14:44:00 -07:00
|
|
|
found = 0
|
2015-07-26 10:46:40 -07:00
|
|
|
for i, subv in ipairs(read_shada_file(shada_fname)) do
|
|
|
|
if i == 1 then
|
|
|
|
eq(1, subv.type)
|
|
|
|
end
|
|
|
|
if subv.type == v.mpack:byte() then
|
|
|
|
if subv.value.mX == true and subv.value.n <= 3 then
|
|
|
|
found = found + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(0, found)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-08-15 07:20:07 -07:00
|
|
|
nvim_command('rshada!' .. shada_fname)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-07-26 10:46:40 -07:00
|
|
|
end)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it('works with register item with BOOL unknown (rX) key', function()
|
|
|
|
wshada('\005\001\015\131\161na\162rX\194\162rc\145\196\001-')
|
|
|
|
eq(0, exc_exec(sdrcmd()))
|
|
|
|
os.remove(shada_fname)
|
|
|
|
nvim_command('wshada ' .. shada_fname)
|
|
|
|
local found = false
|
|
|
|
for _, v in ipairs(read_shada_file(shada_fname)) do
|
|
|
|
if v.type == 5 and v.value.rX == false then
|
|
|
|
found = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(true, found)
|
|
|
|
eq(0, exc_exec(sdrcmd()))
|
|
|
|
os.remove(shada_fname)
|
|
|
|
nvim_command('let @a = "Test"')
|
|
|
|
nvim_command('wshada ' .. shada_fname)
|
|
|
|
found = false
|
|
|
|
for _, v in ipairs(read_shada_file(shada_fname)) do
|
|
|
|
if v.type == 5 and v.value.rX == false then
|
|
|
|
found = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(false, found)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-08-15 07:20:07 -07:00
|
|
|
nvim_command('rshada!' .. shada_fname)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-07-26 10:46:40 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('works with register item with <C-a> name', function()
|
|
|
|
wshada('\005\001\015\131\161n\001\162rX\194\162rc\145\196\001-')
|
|
|
|
eq(0, exc_exec(sdrcmd(true)))
|
|
|
|
nvim_command('wshada ' .. shada_fname)
|
|
|
|
local found = 0
|
|
|
|
for i, v in ipairs(read_shada_file(shada_fname)) do
|
|
|
|
if i == 1 then
|
|
|
|
eq(1, v.type)
|
|
|
|
end
|
|
|
|
if v.type == 5 then
|
|
|
|
if v.value.rX == false and v.value.n == 1 then
|
|
|
|
found = found + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(1, found)
|
|
|
|
nvim_command('wshada! ' .. shada_fname)
|
2015-11-17 14:44:00 -07:00
|
|
|
found = 0
|
2015-07-26 10:46:40 -07:00
|
|
|
for i, v in ipairs(read_shada_file(shada_fname)) do
|
|
|
|
if i == 1 then
|
|
|
|
eq(1, v.type)
|
|
|
|
end
|
|
|
|
if v.type == 5 then
|
|
|
|
if v.value.rX == false and v.value.n == 1 then
|
|
|
|
found = found + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(0, found)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-08-15 07:20:07 -07:00
|
|
|
nvim_command('rshada!' .. shada_fname)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-07-26 10:46:40 -07:00
|
|
|
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)))
|
2024-01-12 10:59:57 -07:00
|
|
|
eq({}, fn.getreg('a', 1, 1))
|
|
|
|
eq('', fn.getregtype('a'))
|
2015-07-26 10:46:40 -07:00
|
|
|
nvim_command('wshada ' .. shada_fname)
|
|
|
|
local found = 0
|
|
|
|
for i, v in ipairs(read_shada_file(shada_fname)) do
|
|
|
|
if i == 1 then
|
|
|
|
eq(1, v.type)
|
|
|
|
end
|
|
|
|
if v.type == 5 then
|
|
|
|
if v.value.rX == false and v.value.rt == 10 then
|
|
|
|
found = found + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(1, found)
|
|
|
|
nvim_command('wshada! ' .. shada_fname)
|
2015-11-17 14:44:00 -07:00
|
|
|
found = 0
|
2015-07-26 10:46:40 -07:00
|
|
|
for i, v in ipairs(read_shada_file(shada_fname)) do
|
|
|
|
if i == 1 then
|
|
|
|
eq(1, v.type)
|
|
|
|
end
|
|
|
|
if v.type == 5 then
|
|
|
|
if v.value.rX == false and v.value.rt == 10 then
|
|
|
|
found = found + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(0, found)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-08-15 07:20:07 -07:00
|
|
|
nvim_command('rshada!' .. shada_fname)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-07-26 10:46:40 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('works with buffer list item with BOOL unknown (bX) key', function()
|
|
|
|
nvim_command('set shada+=%')
|
2017-09-21 06:50:56 -07:00
|
|
|
wshada('\009\000\016\145\130\161f\196\006' .. mock_file_path .. 'c\162bX\195')
|
2015-07-26 10:46:40 -07:00
|
|
|
eq(0, exc_exec(sdrcmd()))
|
2024-01-12 10:59:57 -07:00
|
|
|
eq(2, fn.bufnr('$'))
|
|
|
|
eq('' .. mock_file_path .. 'c', fn.bufname(2))
|
2015-07-26 10:46:40 -07:00
|
|
|
os.remove(shada_fname)
|
|
|
|
nvim_command('wshada ' .. shada_fname)
|
|
|
|
local found = false
|
|
|
|
for _, v in ipairs(read_shada_file(shada_fname)) do
|
|
|
|
if v.type == 9 and #v.value == 1 and v.value[1].bX == true then
|
|
|
|
found = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(true, found)
|
|
|
|
eq(0, exc_exec(sdrcmd()))
|
|
|
|
os.remove(shada_fname)
|
|
|
|
nvim_command('buffer 2')
|
|
|
|
nvim_command('edit!')
|
|
|
|
nvim_command('wshada ' .. shada_fname)
|
|
|
|
found = false
|
|
|
|
for _, v in ipairs(read_shada_file(shada_fname)) do
|
|
|
|
if v.type == 5 and v.value.rX == false then
|
|
|
|
found = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(false, found)
|
|
|
|
nvim_command('bwipeout!')
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-08-15 07:20:07 -07:00
|
|
|
nvim_command('rshada!' .. shada_fname)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-07-26 10:46:40 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('works with history item with BOOL additional value in list', function()
|
|
|
|
wshada('\004\000\006\147\000\196\001-\194')
|
|
|
|
eq(0, exc_exec(sdrcmd()))
|
|
|
|
os.remove(shada_fname)
|
|
|
|
nvim_command('wshada ' .. shada_fname)
|
|
|
|
local found = false
|
|
|
|
for _, v in ipairs(read_shada_file(shada_fname)) do
|
|
|
|
if v.type == 4 and v.value[1] == 0 and v.value[2] == '-' then
|
|
|
|
eq(false, v.value[3])
|
|
|
|
eq(3, #v.value)
|
|
|
|
found = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(true, found)
|
|
|
|
eq(0, exc_exec(sdrcmd()))
|
|
|
|
os.remove(shada_fname)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.histadd(':', '--')
|
|
|
|
fn.histadd(':', '-')
|
2015-07-26 10:46:40 -07:00
|
|
|
nvim_command('wshada ' .. shada_fname)
|
|
|
|
found = false
|
|
|
|
for _, v in ipairs(read_shada_file(shada_fname)) do
|
|
|
|
if v.type == 4 and v.value[1] == 0 and v.value[2] == '-' then
|
|
|
|
eq(2, #v.value)
|
|
|
|
found = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(true, found)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-08-15 07:20:07 -07:00
|
|
|
nvim_command('rshada!' .. shada_fname)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-07-26 10:46:40 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('works with history item with type 10', function()
|
|
|
|
wshada('\004\000\006\147\010\196\001-\194')
|
|
|
|
eq(0, exc_exec(sdrcmd()))
|
|
|
|
nvim_command('wshada ' .. shada_fname)
|
|
|
|
eq(0, exc_exec(sdrcmd()))
|
|
|
|
local found = 0
|
|
|
|
for i, v in ipairs(read_shada_file(shada_fname)) do
|
|
|
|
if i == 1 then
|
|
|
|
eq(1, v.type)
|
|
|
|
end
|
|
|
|
if v.type == 4 then
|
|
|
|
if v.value[1] == 10 and #v.value == 3 and v.value[3] == false then
|
|
|
|
found = found + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(1, found)
|
|
|
|
nvim_command('wshada! ' .. shada_fname)
|
2015-11-17 14:44:00 -07:00
|
|
|
found = 0
|
2015-07-26 10:46:40 -07:00
|
|
|
for i, v in ipairs(read_shada_file(shada_fname)) do
|
|
|
|
if i == 1 then
|
|
|
|
eq(1, v.type)
|
|
|
|
end
|
|
|
|
if v.type == 4 then
|
|
|
|
if v.value[1] == 10 and #v.value == 3 and v.value[3] == false then
|
|
|
|
found = found + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(0, found)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-08-15 07:20:07 -07:00
|
|
|
nvim_command('rshada!' .. shada_fname)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-07-26 10:46:40 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('works with item with 100 type', function()
|
|
|
|
wshada('\100\000\006\147\010\196\001-\194')
|
|
|
|
eq(0, exc_exec(sdrcmd()))
|
|
|
|
nvim_command('wshada ' .. shada_fname)
|
|
|
|
eq(0, exc_exec(sdrcmd()))
|
|
|
|
local found = 0
|
|
|
|
for i, v in ipairs(read_shada_file(shada_fname)) do
|
|
|
|
if i == 1 then
|
|
|
|
eq(1, v.type)
|
|
|
|
end
|
|
|
|
if v.type == 100 then
|
|
|
|
if v.value[1] == 10 and #v.value == 3 and v.value[3] == false then
|
|
|
|
found = found + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(1, found)
|
|
|
|
nvim_command('wshada! ' .. shada_fname)
|
2015-11-17 14:44:00 -07:00
|
|
|
found = 0
|
2015-07-26 10:46:40 -07:00
|
|
|
for i, v in ipairs(read_shada_file(shada_fname)) do
|
|
|
|
if i == 1 then
|
|
|
|
eq(1, v.type)
|
|
|
|
end
|
|
|
|
if v.type == 100 then
|
|
|
|
if v.value[1] == 10 and #v.value == 3 and v.value[3] == false then
|
|
|
|
found = found + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
eq(0, found)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-08-15 07:20:07 -07:00
|
|
|
nvim_command('rshada!' .. shada_fname)
|
2024-01-12 10:59:57 -07:00
|
|
|
fn.garbagecollect(1)
|
|
|
|
fn.garbagecollect(1)
|
2015-07-26 10:46:40 -07:00
|
|
|
end)
|
|
|
|
end)
|