diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2017-06-10 15:25:23 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2017-11-26 09:17:04 +0100 |
commit | 91b856cccec89d5a29c280441f4a6aa7c8393268 (patch) | |
tree | 1f0c5a07564809f53349b884856c24e6c6f45611 /test/functional/helpers.lua | |
parent | baa981ea214ebaf606df443b2928ee93a7e6f7b9 (diff) | |
download | rneovim-91b856cccec89d5a29c280441f4a6aa7c8393268.tar.gz rneovim-91b856cccec89d5a29c280441f4a6aa7c8393268.tar.bz2 rneovim-91b856cccec89d5a29c280441f4a6aa7c8393268.zip |
channels: tests
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r-- | test/functional/helpers.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 2472062d1e..272d2045c9 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -100,6 +100,22 @@ local function next_message() return session:next_message() end +local function expect_twostreams(msgs1, msgs2) + local pos1, pos2 = 1, 1 + while pos1 <= #msgs1 or pos2 <= #msgs2 do + local msg = next_message() + if pos1 <= #msgs1 and pcall(eq, msgs1[pos1], msg) then + pos1 = pos1 + 1 + elseif pos2 <= #msgs2 then + eq(msgs2[pos2], msg) + pos2 = pos2 + 1 + else + -- already failed, but show the right error message + eq(msgs1[pos1], msg) + end + end +end + local function call_and_stop_on_error(...) local status, result = copcall(...) -- luacheck: ignore if not status then @@ -663,6 +679,7 @@ local module = { command = nvim_command, request = request, next_message = next_message, + expect_twostreams = expect_twostreams, run = run, stop = stop, eq = eq, |