aboutsummaryrefslogtreecommitdiff
path: root/test/functional/helpers.lua
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2020-10-10 18:31:46 +0200
committerGitHub <noreply@github.com>2020-10-10 18:31:46 +0200
commitf7cc3ae0b7b8ce67294c00729d278362ad60a4f0 (patch)
tree5b601432a0b2d835bb31a8d2776d74bfd9b885b0 /test/functional/helpers.lua
parent405044a41206e325c4f3ecaa6c62ed8f4bb32abe (diff)
parent6bf414c0d74ed6f2c573e87290830bade4330c9a (diff)
downloadrneovim-f7cc3ae0b7b8ce67294c00729d278362ad60a4f0.tar.gz
rneovim-f7cc3ae0b7b8ce67294c00729d278362ad60a4f0.tar.bz2
rneovim-f7cc3ae0b7b8ce67294c00729d278362ad60a4f0.zip
Merge pull request #13038 from bfredl/multiluahl
api: multiple decoration providers at once
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r--test/functional/helpers.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index e4fb95442c..99cbf30c7c 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -22,6 +22,7 @@ local ok = global_helpers.ok
local sleep = global_helpers.sleep
local tbl_contains = global_helpers.tbl_contains
local write_file = global_helpers.write_file
+local fail = global_helpers.fail
local module = {
NIL = mpack.NIL,
@@ -592,6 +593,24 @@ function module.expect_any(contents)
return ok(nil ~= string.find(module.curbuf_contents(), contents, 1, true))
end
+function module.expect_events(expected, received, kind)
+ local inspect = require'vim.inspect'
+ if not pcall(eq, expected, received) then
+ local msg = 'unexpected '..kind..' received.\n\n'
+
+ msg = msg .. 'received events:\n'
+ for _, e in ipairs(received) do
+ msg = msg .. ' ' .. inspect(e) .. ';\n'
+ end
+ msg = msg .. '\nexpected events:\n'
+ for _, e in ipairs(expected) do
+ msg = msg .. ' ' .. inspect(e) .. ';\n'
+ end
+ fail(msg)
+ end
+ return received
+end
+
-- Checks that the Nvim session did not terminate.
function module.assert_alive()
assert(2 == module.eval('1+1'), 'crash? request failed')