|
1 | | -*eval.txt* For Vim version 7.4. Last change: 2015 Sep 19 |
| 1 | +*eval.txt* For Vim version 7.4. Last change: 2015 Nov 30 |
2 | 2 |
|
3 | 3 |
|
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -1379,6 +1379,15 @@ v:errmsg Last given error message. It's allowed to set this variable. |
1379 | 1379 | : ... handle error |
1380 | 1380 | < "errmsg" also works, for backwards compatibility. |
1381 | 1381 |
|
| 1382 | + *v:errors* *errors-variable* |
| 1383 | +v:errors Errors found by assert functions, such as |assert_true()|. |
| 1384 | + This is a list of strings. |
| 1385 | + The assert functions append an item when an assert fails. |
| 1386 | + To remove old results make it empty: > |
| 1387 | + :let v:errors = [] |
| 1388 | +< If v:errors is set to anything but a list it is made an empty |
| 1389 | + list by the assert function. |
| 1390 | + |
1382 | 1391 | *v:exception* *exception-variable* |
1383 | 1392 | v:exception The value of the exception most recently caught and not |
1384 | 1393 | finished. See also |v:throwpoint| and |throw-variables|. |
@@ -1733,10 +1742,13 @@ append( {lnum}, {string}) Number append {string} below line {lnum} |
1733 | 1742 | append( {lnum}, {list}) Number append lines {list} below line {lnum} |
1734 | 1743 | argc() Number number of files in the argument list |
1735 | 1744 | argidx() Number current index in the argument list |
1736 | | -arglistid( [{winnr}, [ {tabnr}]]) |
| 1745 | +arglistid( [{winnr} [, {tabnr}]]) |
1737 | 1746 | Number argument list id |
1738 | 1747 | argv( {nr}) String {nr} entry of the argument list |
1739 | 1748 | argv( ) List the argument list |
| 1749 | +assert_equal( {exp}, {act} [, {msg}]) none assert that {exp} equals {act} |
| 1750 | +assert_false( {actual} [, {msg}]) none assert that {actual} is false |
| 1751 | +assert_true( {actual} [, {msg}]) none assert that {actual} is true |
1740 | 1752 | asin( {expr}) Float arc sine of {expr} |
1741 | 1753 | atan( {expr}) Float arc tangent of {expr} |
1742 | 1754 | atan2( {expr}, {expr}) Float arc tangent of {expr1} / {expr2} |
@@ -2154,6 +2166,37 @@ argv([{nr}]) The result is the {nr}th file in the argument list of the |
2154 | 2166 | < Without the {nr} argument a |List| with the whole |arglist| is |
2155 | 2167 | returned. |
2156 | 2168 |
|
| 2169 | + *assert_equal()* |
| 2170 | +assert_equal({expected}, {actual}, [, {msg}]) |
| 2171 | + When {expected} and {actual} are not equal an error message is |
| 2172 | + added to |v:errors|. |
| 2173 | + There is no automatic conversion, the String "4" is different |
| 2174 | + from the Number 4. And the number 4 is different from the |
| 2175 | + Float 4.0. The value of 'ignorecase' is not used here, case |
| 2176 | + always matters. |
| 2177 | + When {msg} is omitted an error in the form "Expected |
| 2178 | + {expected} but got {actual}" is produced. |
| 2179 | + Example: > |
| 2180 | + assert_equal('foo', 'bar') |
| 2181 | +< Will result in a string to be added to |v:errors|: |
| 2182 | + test.vim line 12: Expected 'foo' but got 'bar' ~ |
| 2183 | + |
| 2184 | +assert_false({actual}, [, {msg}]) *assert_false()* |
| 2185 | + When {actual} is not false an error message is added to |
| 2186 | + |v:errors|, like with |assert_equal()|.. |
| 2187 | + A value is false when it is zero. When "{actual}" is not a |
| 2188 | + number the assert fails. |
| 2189 | + When {msg} is omitted an error in the form "Expected False but |
| 2190 | + got {actual}" is produced. |
| 2191 | + |
| 2192 | +assert_true({actual}, [, {msg}]) *assert_true()* |
| 2193 | + When {actual} is not true an error message is added to |
| 2194 | + |v:errors|, like with |assert_equal()|.. |
| 2195 | + A value is true when it is a non-zeron number. When {actual} |
| 2196 | + is not a number the assert fails. |
| 2197 | + When {msg} is omitted an error in the form "Expected True but |
| 2198 | + got {actual}" is produced. |
| 2199 | + |
2157 | 2200 | asin({expr}) *asin()* |
2158 | 2201 | Return the arc sine of {expr} measured in radians, as a |Float| |
2159 | 2202 | in the range of [-pi/2, pi/2]. |
|
0 commit comments