import { assert_match } from "https://deno.land/x/denops_std@v5.0.2/function/vim/mod.ts";
When {pattern} does not match {actual} an error message is
added to v:errors
. Also see assert-return
.
{pattern} is used as with =~
: The matching is always done
like 'magic' was set and 'cpoptions' is empty, no matter what
the actual value of 'magic' or 'cpoptions' is.
{actual} is used as a string, automatic conversion applies. Use "^" and "$" to match with the start and end of the text. Use both to match the whole text.
When {msg} is omitted an error in the form "Pattern {pattern} does not match {actual}" is produced. Example:
assert_match('^f.*o$', 'foobar')
Will result in a string to be added to v:errors
:
test.vim line 12: Pattern '^f.*o$' does not match 'foobar'
Can also be used as a method
:
getFile()->assert_match('foo.*')