diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-04-11 22:07:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-11 22:07:00 +0200 |
commit | 87f4d2592c2ba164683b1f0f813cf9f029a0abfb (patch) | |
tree | 252717790553331e3d6c7245bb9d9be86ccdf101 /test/helpers.lua | |
parent | f96d99ad1118d79ae5c38bb5e2c4be1280caa3cc (diff) | |
download | rneovim-87f4d2592c2ba164683b1f0f813cf9f029a0abfb.tar.gz rneovim-87f4d2592c2ba164683b1f0f813cf9f029a0abfb.tar.bz2 rneovim-87f4d2592c2ba164683b1f0f813cf9f029a0abfb.zip |
test/util: expect_err() (#8257)
other cleanup, ref #8245
Diffstat (limited to 'test/helpers.lua')
-rw-r--r-- | test/helpers.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/helpers.lua b/test/helpers.lua index 0b6a10a29a..e0645d083f 100644 --- a/test/helpers.lua +++ b/test/helpers.lua @@ -22,6 +22,13 @@ local function matches(pat, actual) end error(string.format('Pattern does not match.\nPattern:\n%s\nActual:\n%s', pat, actual)) end +-- Expect an error matching pattern `pat`. +local function expect_err(pat, ...) + local fn = select(1, ...) + local fn_args = {...} + table.remove(fn_args, 1) + assert.error_matches(function() return fn(unpack(fn_args)) end, pat) +end -- initial_path: directory to recurse into -- re: include pattern (string) @@ -569,6 +576,7 @@ return { deepcopy = deepcopy, dictdiff = dictdiff, eq = eq, + expect_err = expect_err, filter = filter, fixtbl = fixtbl, fixtbl_rec = fixtbl_rec, |