test/util: remove eq_any()

It was added in the parent commit, but ended up not being used. And
I can't think of a case where it will be used: instead we would probably
want to generalize expect_msg_seq() if necessary.
This commit is contained in:
Justin M. Keyes 2018-02-18 19:22:44 +01:00
parent e72ecdb7ca
commit 7973847d02
2 changed files with 2 additions and 25 deletions

View File

@ -14,7 +14,6 @@ local check_cores = global_helpers.check_cores
local check_logs = global_helpers.check_logs
local neq = global_helpers.neq
local eq = global_helpers.eq
local eq_any = global_helpers.eq_any
local ok = global_helpers.ok
local map = global_helpers.map
local filter = global_helpers.filter
@ -733,7 +732,6 @@ local module = {
curwinmeths = curwinmeths,
dedent = dedent,
eq = eq,
eq_any = eq_any,
eval = nvim_eval,
exc_exec = exc_exec,
expect = expect,

View File

@ -10,28 +10,8 @@ local check_logs_useless_lines = {
local function eq(expected, actual)
return assert.are.same(expected, actual)
end
-- Tries multiple accepted ("expected") values until one succeeds.
-- First N-1 arguments are the accepted values.
-- Last (Nth) argument is the "actual" value to be compared.
local function eq_any(...)
if select('#', ...) < 2 then
error('need at least 2 arguments')
end
local args = {...}
local actual = args[#args]
local final_error = ''
for anum = 1, select('#', ...) - 1 do
local accepted = args[anum]
local status, result = pcall(eq, accepted, actual)
if status then
return result
end
final_error = final_error..tostring(result)
end
error(final_error)
end
local function neq(exp, act)
return assert.are_not.same(exp, act)
local function neq(expected, actual)
return assert.are_not.same(expected, actual)
end
local function ok(res)
return assert.is_true(res)
@ -581,7 +561,6 @@ return {
deepcopy = deepcopy,
dictdiff = dictdiff,
eq = eq,
eq_any = eq_any,
filter = filter,
fixtbl = fixtbl,
fixtbl_rec = fixtbl_rec,