comparison runtime/doc/eval.txt @ 8749:65a5a18d3acf v7.4.1663

commit https://github.com/vim/vim/commit/ea6553bec340920d8a09c7210cdc2d218e25ace2 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 27 15:13:38 2016 +0200 patch 7.4.1663 Problem: In tests it's often useful to check if a pattern matches. Solution: Add assert_match().
author Christian Brabandt <cb@256bit.org>
date Sun, 27 Mar 2016 15:15:06 +0200
parents b1a19a2f73f0
children dda254280bab
comparison
equal deleted inserted replaced
8748:b1a19a2f73f0 8749:65a5a18d3acf
1 *eval.txt* For Vim version 7.4. Last change: 2016 Mar 26 1 *eval.txt* For Vim version 7.4. Last change: 2016 Mar 27
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
1803 argv() List the argument list 1803 argv() List the argument list
1804 assert_equal( {exp}, {act} [, {msg}]) none assert {exp} equals {act} 1804 assert_equal( {exp}, {act} [, {msg}]) none assert {exp} equals {act}
1805 assert_exception( {error} [, {msg}]) none assert {error} is in v:exception 1805 assert_exception( {error} [, {msg}]) none assert {error} is in v:exception
1806 assert_fails( {cmd} [, {error}]) none assert {cmd} fails 1806 assert_fails( {cmd} [, {error}]) none assert {cmd} fails
1807 assert_false( {actual} [, {msg}]) none assert {actual} is false 1807 assert_false( {actual} [, {msg}]) none assert {actual} is false
1808 assert_match( {pat}, {text} [, {msg}]) none assert {pat} matches {text}
1808 assert_true( {actual} [, {msg}]) none assert {actual} is true 1809 assert_true( {actual} [, {msg}]) none assert {actual} is true
1809 asin( {expr}) Float arc sine of {expr} 1810 asin( {expr}) Float arc sine of {expr}
1810 atan( {expr}) Float arc tangent of {expr} 1811 atan( {expr}) Float arc tangent of {expr}
1811 atan2( {expr}, {expr}) Float arc tangent of {expr1} / {expr2} 1812 atan2( {expr}, {expr}) Float arc tangent of {expr1} / {expr2}
1812 browse( {save}, {title}, {initdir}, {default}) 1813 browse( {save}, {title}, {initdir}, {default})
2313 A value is false when it is zero. When {actual} is not a 2314 A value is false when it is zero. When {actual} is not a
2314 number the assert fails. 2315 number the assert fails.
2315 When {msg} is omitted an error in the form "Expected False but 2316 When {msg} is omitted an error in the form "Expected False but
2316 got {actual}" is produced. 2317 got {actual}" is produced.
2317 2318
2319 *assert_match()*
2320 assert_match({pattern}, {actual} [, {msg}])
2321 When {pattern} does not match {actual} an error message is
2322 added to |v:errors|.
2323
2324 {pattern} is used as with |=~|: The matching is always done
2325 like 'magic' was set and 'cpoptions' is empty, no matter what
2326 the actual value of 'magic' or 'cpoptions' is.
2327
2328 {actual} is used as a string, automatic conversion applies.
2329 Use "^" and "$" to match with the start and end of the text.
2330 Use both to match the whole text.
2331
2332 When {msg} is omitted an error in the form "Pattern {pattern}
2333 does not match {actual}" is produced.
2334 Example: >
2335 assert_match('^f.*o$', 'foobar')
2336 < Will result in a string to be added to |v:errors|:
2337 test.vim line 12: Pattern '^f.*o$' does not match 'foobar' ~
2338
2318 assert_true({actual} [, {msg}]) *assert_true()* 2339 assert_true({actual} [, {msg}]) *assert_true()*
2319 When {actual} is not true an error message is added to 2340 When {actual} is not true an error message is added to
2320 |v:errors|, like with |assert_equal()|. 2341 |v:errors|, like with |assert_equal()|.
2321 A value is true when it is a non-zero number. When {actual} 2342 A value is true when it is a non-zero number. When {actual}
2322 is not a number the assert fails. 2343 is not a number the assert fails.