diff options
author | Daniel Hahler <git@thequod.de> | 2019-09-12 13:06:34 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-11-09 21:58:28 -0800 |
commit | c0abaf9ca604485ceee04ae8ca83c11382febc89 (patch) | |
tree | 243fd810067c7c23c0f4e3156f43c9c7ceae3089 /test | |
parent | 268252c8c729fa6076037c04966c0a6e694dab75 (diff) | |
download | rneovim-c0abaf9ca604485ceee04ae8ca83c11382febc89.tar.gz rneovim-c0abaf9ca604485ceee04ae8ca83c11382febc89.tar.bz2 rneovim-c0abaf9ca604485ceee04ae8ca83c11382febc89.zip |
tests: Screen:expect: support "{MATCH:…}"
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/ui/screen.lua | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index 41e022791e..e9583bf805 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -391,14 +391,17 @@ function Screen:expect(expected, attr_ids, ...) .. ' 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 |