tests: lua buffer updates: reorg check_events()

This commit is contained in:
Björn Linse 2020-09-19 09:58:31 +02:00
parent 179f0bca18
commit 4cc2a7af4b

View File

@ -287,7 +287,10 @@ describe('lua: nvim_buf_attach on_bytes', function()
fail(msg) fail(msg)
end end
if verify then if not verify then
return
end
for _, event in ipairs(events) do for _, event in ipairs(events) do
for _, elem in ipairs(event) do for _, elem in ipairs(event) do
if type(elem) == "number" and elem < 0 then if type(elem) == "number" and elem < 0 then
@ -305,8 +308,10 @@ describe('lua: nvim_buf_attach on_bytes', function()
shadowbytes = before .. unknown .. after shadowbytes = before .. unknown .. after
end end
end end
local text = meths.buf_get_lines(0, 0, -1, true) local text = meths.buf_get_lines(0, 0, -1, true)
local bytes = table.concat(text, '\n') .. '\n' local bytes = table.concat(text, '\n') .. '\n'
eq(string.len(bytes), string.len(shadowbytes), '\non_bytes: total bytecount of buffer is wrong') eq(string.len(bytes), string.len(shadowbytes), '\non_bytes: total bytecount of buffer is wrong')
for i = 1, string.len(shadowbytes) do for i = 1, string.len(shadowbytes) do
local shadowbyte = string.sub(shadowbytes, i, i) local shadowbyte = string.sub(shadowbytes, i, i)
@ -315,7 +320,6 @@ describe('lua: nvim_buf_attach on_bytes', function()
end end
end end
end end
end
return check_events return check_events
end end