diff options
Diffstat (limited to 'tests/conformance.lua')
| -rw-r--r-- | tests/conformance.lua | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/tests/conformance.lua b/tests/conformance.lua index b8f37cb..7b044f1 100644 --- a/tests/conformance.lua +++ b/tests/conformance.lua @@ -647,20 +647,19 @@ local function meaningful_host_operations(context) return result end -local function assert_expected_operations(expected, actual, context, label) - local used = {} +local function assert_expected_sequence(expected, actual, context, label) + local actual_index = 1 for _, wanted_source in ipairs(expected) do local wanted = vim.deepcopy(wanted_source) if wanted.identity ~= nil then wanted.identity = alias_identity(context, wanted.identity) end local found - for index, candidate in ipairs(actual) do - if not used[index] - and pcall(deep_same, wanted, candidate, label, true) - then + while actual_index <= #actual do + local candidate = actual[actual_index] + actual_index = actual_index + 1 + if pcall(deep_same, wanted, candidate, label, true) then found = candidate - used[index] = true break end end @@ -752,7 +751,7 @@ local function assert_scenario(context) end) deep_same(scenario.expect.diagnostics, diagnostics, "diagnostics", false) - assert_expected_operations( + assert_expected_sequence( scenario.expect.host_operations, meaningful_host_operations(context), context, |
