aboutsummaryrefslogtreecommitdiff
path: root/test/helpers.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-04-13 02:13:29 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-04-13 17:07:58 +0200
commit7e1591e06ab85bf088c7482a15ad48fc58c1005d (patch)
tree5a1e8c7f87d11bd28598836c7a989186bd3e0746 /test/helpers.lua
parentd08692a8246039b938b5645a6c01b4ff7f51671e (diff)
downloadrneovim-7e1591e06ab85bf088c7482a15ad48fc58c1005d.tar.gz
rneovim-7e1591e06ab85bf088c7482a15ad48fc58c1005d.tar.bz2
rneovim-7e1591e06ab85bf088c7482a15ad48fc58c1005d.zip
API: emit nvim_error_event on failed async request
We already do this for _invalid_ async requests #9300. Now we also do it for failed invocation of valid requests.
Diffstat (limited to 'test/helpers.lua')
-rw-r--r--test/helpers.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/helpers.lua b/test/helpers.lua
index 795808005d..89cf13f917 100644
--- a/test/helpers.lua
+++ b/test/helpers.lua
@@ -627,6 +627,19 @@ local function table_flatten(arr)
return result
end
+-- Checks if a list-like (vector) table contains `value`.
+local function table_contains(t, value)
+ if type(t) ~= 'table' then
+ error('t must be a table')
+ end
+ for _,v in ipairs(t) do
+ if v == value then
+ return true
+ end
+ end
+ return false
+end
+
local function hexdump(str)
local len = string.len(str)
local dump = ""
@@ -771,6 +784,7 @@ local module = {
repeated_read_cmd = repeated_read_cmd,
shallowcopy = shallowcopy,
sleep = sleep,
+ table_contains = table_contains,
table_flatten = table_flatten,
tmpname = tmpname,
uname = uname,