mirror of
https://github.com/neovim/neovim.git
synced 2025-11-08 19:45:12 +00:00
functests: Improve screen:expect error reporting
This commit is contained in:
@@ -219,12 +219,22 @@ function Screen:expect(expected, attr_ids, attr_ignore)
|
|||||||
local ids = attr_ids or self._default_attr_ids
|
local ids = attr_ids or self._default_attr_ids
|
||||||
local ignore = attr_ignore or self._default_attr_ignore
|
local ignore = attr_ignore or self._default_attr_ignore
|
||||||
self:wait(function()
|
self:wait(function()
|
||||||
|
local actual_rows = {}
|
||||||
for i = 1, self._height do
|
for i = 1, self._height do
|
||||||
local expected_row = expected_rows[i]
|
actual_rows[i] = self:_row_repr(self._rows[i], ids, ignore)
|
||||||
local actual_row = self:_row_repr(self._rows[i], ids, ignore)
|
end
|
||||||
if expected_row ~= actual_row then
|
for i = 1, self._height do
|
||||||
return 'Row '..tostring(i)..' didn\'t match.\nExpected: "'..
|
if expected_rows[i] ~= actual_rows[i] then
|
||||||
expected_row..'"\nActual: "'..actual_row..'"'
|
local msg_expected_rows = {}
|
||||||
|
for i = 1, #expected_rows do msg_expected_rows[i] = expected_rows[i] end
|
||||||
|
msg_expected_rows[i] = '*' .. msg_expected_rows[i]
|
||||||
|
actual_rows[i] = '*' .. actual_rows[i]
|
||||||
|
msg = (
|
||||||
|
'Row ' .. tostring(i) .. ' didn\'t match.\n'
|
||||||
|
.. 'Expected:\n|' .. table.concat(msg_expected_rows, '|\n|') .. '|\n'
|
||||||
|
.. 'Actual:\n|' .. table.concat(actual_rows, '|\n|') .. '|'
|
||||||
|
)
|
||||||
|
return msg
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user