mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
test/util: matches()
This commit is contained in:
parent
f19db1b9ba
commit
b11b681289
@ -16,6 +16,7 @@ local neq = global_helpers.neq
|
|||||||
local eq = global_helpers.eq
|
local eq = global_helpers.eq
|
||||||
local ok = global_helpers.ok
|
local ok = global_helpers.ok
|
||||||
local map = global_helpers.map
|
local map = global_helpers.map
|
||||||
|
local matches = global_helpers.matches
|
||||||
local filter = global_helpers.filter
|
local filter = global_helpers.filter
|
||||||
local dedent = global_helpers.dedent
|
local dedent = global_helpers.dedent
|
||||||
local table_flatten = global_helpers.table_flatten
|
local table_flatten = global_helpers.table_flatten
|
||||||
@ -747,6 +748,7 @@ local module = {
|
|||||||
insert = insert,
|
insert = insert,
|
||||||
iswin = iswin,
|
iswin = iswin,
|
||||||
map = map,
|
map = map,
|
||||||
|
matches = matches,
|
||||||
merge_args = merge_args,
|
merge_args = merge_args,
|
||||||
meth_pcall = meth_pcall,
|
meth_pcall = meth_pcall,
|
||||||
meths = meths,
|
meths = meths,
|
||||||
|
@ -16,6 +16,12 @@ end
|
|||||||
local function ok(res)
|
local function ok(res)
|
||||||
return assert.is_true(res)
|
return assert.is_true(res)
|
||||||
end
|
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
|
-- initial_path: directory to recurse into
|
||||||
-- re: include pattern (string)
|
-- re: include pattern (string)
|
||||||
@ -572,6 +578,7 @@ return {
|
|||||||
hasenv = hasenv,
|
hasenv = hasenv,
|
||||||
intchar2lua = intchar2lua,
|
intchar2lua = intchar2lua,
|
||||||
map = map,
|
map = map,
|
||||||
|
matches = matches,
|
||||||
mergedicts_copy = mergedicts_copy,
|
mergedicts_copy = mergedicts_copy,
|
||||||
neq = neq,
|
neq = neq,
|
||||||
ok = ok,
|
ok = ok,
|
||||||
|
Loading…
Reference in New Issue
Block a user