aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2016-07-08 13:32:25 -0400
committerJames McCoy <jamessan@jamessan.com>2016-07-23 20:42:46 -0400
commitaece3ffa7dca546bd5c358478dfb9f423519e211 (patch)
tree28002fc970d2b22a620d97fd91e7b74e6c6c7568 /runtime/doc
parent8c1fb99d2d4058d2cc1decbfed89b1f73b38cef6 (diff)
downloadrneovim-aece3ffa7dca546bd5c358478dfb9f423519e211.tar.gz
rneovim-aece3ffa7dca546bd5c358478dfb9f423519e211.tar.bz2
rneovim-aece3ffa7dca546bd5c358478dfb9f423519e211.zip
vim-patch:7.4.1663
Problem: In tests it's often useful to check if a pattern matches. Solution: Add assert_match(). https://github.com/vim/vim/commit/ea6553bec340920d8a09c7210cdc2d218e25ace2
Diffstat (limited to 'runtime/doc')
-rw-r--r--runtime/doc/eval.txt23
1 files changed, 22 insertions, 1 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index efb8da0cfa..7b6a330e94 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt* For Vim version 7.4. Last change: 2016 Apr 12
+*eval.txt* For Vim version 7.4. Last change: 2016 Mar 27
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1788,6 +1788,7 @@ assert_equal({exp}, {act} [, {msg}]) none assert {exp} equals {act}
assert_exception( {error} [, {msg}]) none assert {error} is in v:exception
assert_fails( {cmd} [, {error}]) none assert {cmd} fails
assert_false({actual} [, {msg}]) none assert {actual} is false
+assert_match( {pat}, {text} [, {msg}]) none assert {pat} matches {text}
assert_true({actual} [, {msg}]) none assert {actual} is true
asin({expr}) Float arc sine of {expr}
atan({expr}) Float arc tangent of {expr}
@@ -2281,6 +2282,26 @@ assert_false({actual} [, {msg}]) *assert_false()*
When {msg} is omitted an error in the form "Expected False but
got {actual}" is produced.
+ *assert_match()*
+assert_match({pattern}, {actual} [, {msg}])
+ When {pattern} does not match {actual} an error message is
+ added to |v:errors|.
+
+ {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' ~
+
assert_true({actual} [, {msg}]) *assert_true()*
When {actual} is not true an error message is added to
|v:errors|, like with |assert_equal()|.