test: Eliminate expect_err

Eliminate `expect_err` in favor of `pcall_err` + `eq` or `matches`.
This commit is contained in:
Justin M. Keyes
2019-09-06 17:17:37 -07:00
parent af946046b9
commit 7e1c959861
21 changed files with 214 additions and 216 deletions

View File

@@ -6,7 +6,7 @@ local clear = helpers.clear
local funcs = helpers.funcs
local command = helpers.command
local exc_exec = helpers.exc_exec
local expect_err = helpers.expect_err
local pcall_err = helpers.pcall_err
before_each(clear)
@@ -41,11 +41,11 @@ describe('setmatches()', function()
end)
it('fails with -1 if highlight group is not defined', function()
expect_err('E28: No such highlight group name: 1', funcs.setmatches,
{{group=1, pattern=2, id=3, priority=4}})
eq('Vim:E28: No such highlight group name: 1',
pcall_err(funcs.setmatches, {{group=1, pattern=2, id=3, priority=4}}))
eq({}, funcs.getmatches())
expect_err('E28: No such highlight group name: 1', funcs.setmatches,
{{group=1, pos1={2}, pos2={6}, id=3, priority=4, conceal=5}})
eq('Vim:E28: No such highlight group name: 1',
pcall_err(funcs.setmatches, {{group=1, pos1={2}, pos2={6}, id=3, priority=4, conceal=5}}))
eq({}, funcs.getmatches())
end)
end)