aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/eval.txt
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/doc/eval.txt')
-rw-r--r--runtime/doc/eval.txt47
1 files changed, 45 insertions, 2 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 89b4825f5b..38ac74f0af 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt* For Vim version 7.4. Last change: 2015 Jan 29
+*eval.txt* For Vim version 7.4. Last change: 2015 Nov 30
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1375,6 +1375,15 @@ v:errmsg Last given error message. It's allowed to set this variable.
: ... handle error
< "errmsg" also works, for backwards compatibility.
+ *v:errors* *errors-variable*
+v:errors Errors found by assert functions, such as |assert_true()|.
+ This is a list of strings.
+ The assert functions append an item when an assert fails.
+ To remove old results make it empty: >
+ :let v:errors = []
+< If v:errors is set to anything but a list it is made an empty
+ list by the assert function.
+
*v:exception* *exception-variable*
v:exception The value of the exception most recently caught and not
finished. See also |v:throwpoint| and |throw-variables|.
@@ -1728,10 +1737,13 @@ append( {lnum}, {string}) Number append {string} below line {lnum}
append( {lnum}, {list}) Number append lines {list} below line {lnum}
argc() Number number of files in the argument list
argidx() Number current index in the argument list
-arglistid( [{winnr}, [ {tabnr}]])
+arglistid( [{winnr} [, {tabnr}]])
Number argument list id
argv( {nr}) String {nr} entry of the argument list
argv( ) List the argument list
+assert_equal( {exp}, {act} [, {msg}]) none assert that {exp} equals {act}
+assert_false( {actual} [, {msg}]) none assert that {actual} is false
+assert_true( {actual} [, {msg}]) none assert that {actual} is true
asin( {expr}) Float arc sine of {expr}
atan( {expr}) Float arc tangent of {expr}
atan2( {expr}, {expr}) Float arc tangent of {expr1} / {expr2}
@@ -2161,6 +2173,37 @@ argv([{nr}]) The result is the {nr}th file in the argument list of the
< Without the {nr} argument a |List| with the whole |arglist| is
returned.
+ *assert_equal()*
+assert_equal({expected}, {actual}, [, {msg}])
+ When {expected} and {actual} are not equal an error message is
+ added to |v:errors|.
+ There is no automatic conversion, the String "4" is different
+ from the Number 4. And the number 4 is different from the
+ Float 4.0. The value of 'ignorecase' is not used here, case
+ always matters.
+ When {msg} is omitted an error in the form "Expected
+ {expected} but got {actual}" is produced.
+ Example: >
+ assert_equal('foo', 'bar')
+< Will result in a string to be added to |v:errors|:
+ test.vim line 12: Expected 'foo' but got 'bar' ~
+
+assert_false({actual}, [, {msg}]) *assert_false()*
+ When {actual} is not false an error message is added to
+ |v:errors|, like with |assert_equal()|..
+ A value is false when it is zero. When "{actual}" is not a
+ number the assert fails.
+ When {msg} is omitted an error in the form "Expected False but
+ got {actual}" is produced.
+
+assert_true({actual}, [, {msg}]) *assert_true()*
+ When {actual} is not true an error message is added to
+ |v:errors|, like with |assert_equal()|..
+ A value is true when it is a non-zeron number. When {actual}
+ is not a number the assert fails.
+ When {msg} is omitted an error in the form "Expected True but
+ got {actual}" is produced.
+
asin({expr}) *asin()*
Return the arc sine of {expr} measured in radians, as a |Float|
in the range of [-pi/2, pi/2].