aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-04-11 01:43:15 +0200
committerJustin M. Keyes <justinkz@gmail.com>2018-04-11 01:58:41 +0200
commitb11b681289582472340e3af72ea116c4ba354066 (patch)
tree54ed5431ab98abf242e520bbc74252d4e0251d12
parentf19db1b9ba864e4e57cc9ee29763ae5f74bcb415 (diff)
downloadrneovim-b11b681289582472340e3af72ea116c4ba354066.tar.gz
rneovim-b11b681289582472340e3af72ea116c4ba354066.tar.bz2
rneovim-b11b681289582472340e3af72ea116c4ba354066.zip
test/util: matches()
-rw-r--r--test/functional/helpers.lua2
-rw-r--r--test/helpers.lua7
2 files changed, 9 insertions, 0 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index b8d912114d..84ba6b6853 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -16,6 +16,7 @@ local neq = global_helpers.neq
local eq = global_helpers.eq
local ok = global_helpers.ok
local map = global_helpers.map
+local matches = global_helpers.matches
local filter = global_helpers.filter
local dedent = global_helpers.dedent
local table_flatten = global_helpers.table_flatten
@@ -747,6 +748,7 @@ local module = {
insert = insert,
iswin = iswin,
map = map,
+ matches = matches,
merge_args = merge_args,
meth_pcall = meth_pcall,
meths = meths,
diff --git a/test/helpers.lua b/test/helpers.lua
index 7cce6d8c55..0b6a10a29a 100644
--- a/test/helpers.lua
+++ b/test/helpers.lua
@@ -16,6 +16,12 @@ end
local function ok(res)
return assert.is_true(res)
end
+local function matches(pat, actual)
+ if nil ~= string.match(actual, pat) then
+ return true
+ end
+ error(string.format('Pattern does not match.\nPattern:\n%s\nActual:\n%s', pat, actual))
+end
-- initial_path: directory to recurse into
-- re: include pattern (string)
@@ -572,6 +578,7 @@ return {
hasenv = hasenv,
intchar2lua = intchar2lua,
map = map,
+ matches = matches,
mergedicts_copy = mergedicts_copy,
neq = neq,
ok = ok,