Skip to content

Commit

Permalink
tests: Screen:expect: support "{MATCH:…}"
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Sep 12, 2019
1 parent 11fe132 commit 6127845
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions test/functional/ui/screen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -400,14 +400,17 @@ function Screen:expect(expected, attr_ids, attr_ignore, ...)
.. ' differs from actual height ' .. #actual_rows .. '.'
end
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
msg_expected_rows[i] = '*' .. msg_expected_rows[i]
if i <= #actual_rows then
actual_rows[i] = '*' .. actual_rows[i]
end
if err_msg == nil then
err_msg = 'Row ' .. tostring(i) .. ' did not match.'
local m = expected_rows[i]:match('{MATCH:(.*)}')
if not m or not actual_rows[i]:match(m) then
msg_expected_rows[i] = '*' .. msg_expected_rows[i]
if i <= #actual_rows then
actual_rows[i] = '*' .. actual_rows[i]
end
if err_msg == nil then
err_msg = 'Row ' .. tostring(i) .. ' did not match.'
end
end
end
end
Expand Down

0 comments on commit 6127845

Please sign in to comment.