mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
tests: Screen:expect: support "{MATCH:…}"
This commit is contained in:
parent
268252c8c7
commit
c0abaf9ca6
@ -391,14 +391,17 @@ function Screen:expect(expected, attr_ids, ...)
|
|||||||
.. ' differs from actual height ' .. #actual_rows .. '.'
|
.. ' differs from actual height ' .. #actual_rows .. '.'
|
||||||
end
|
end
|
||||||
for i = 1, #expected_rows do
|
for i = 1, #expected_rows do
|
||||||
msg_expected_rows[i] = expected_rows[i]
|
msg_expected_rows[i] = expected_rows[i]
|
||||||
if expected_rows[i] ~= actual_rows[i] and expected_rows[i] ~= "{IGNORE}|" then
|
if expected_rows[i] ~= actual_rows[i] and expected_rows[i] ~= "{IGNORE}|" then
|
||||||
msg_expected_rows[i] = '*' .. msg_expected_rows[i]
|
local m = expected_rows[i]:match('{MATCH:(.*)}')
|
||||||
if i <= #actual_rows then
|
if not m or not actual_rows[i]:match(m) then
|
||||||
actual_rows[i] = '*' .. actual_rows[i]
|
msg_expected_rows[i] = '*' .. msg_expected_rows[i]
|
||||||
end
|
if i <= #actual_rows then
|
||||||
if err_msg == nil then
|
actual_rows[i] = '*' .. actual_rows[i]
|
||||||
err_msg = 'Row ' .. tostring(i) .. ' did not match.'
|
end
|
||||||
|
if err_msg == nil then
|
||||||
|
err_msg = 'Row ' .. tostring(i) .. ' did not match.'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user