aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorwatiko <service@mail.watiko.net>2015-12-13 12:19:54 +0900
committerwatiko <service@mail.watiko.net>2016-01-10 09:01:30 +0900
commit593df501b3a3687abb14a84299716bcd328b6ff8 (patch)
tree5b9b9a381ea8f25d60e35a3be65f483703a33a7b /runtime
parent50db0312f941ba489466d7d6b21088f1870429ee (diff)
downloadrneovim-593df501b3a3687abb14a84299716bcd328b6ff8.tar.gz
rneovim-593df501b3a3687abb14a84299716bcd328b6ff8.tar.bz2
rneovim-593df501b3a3687abb14a84299716bcd328b6ff8.zip
vim-patch:7.4.944
Problem: Writing tests for Vim script is hard. Solution: Add assertEqual(), assertFalse() and assertTrue() functions. Add the v:errors variable. Add the runtest script. Add a first new style test script. https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/eval.txt39
1 files changed, 38 insertions, 1 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 89b4825f5b..91b4760ca5 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 29
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 |assertTrue()|.
+ 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|.
@@ -1732,6 +1741,9 @@ arglistid( [{winnr}, [ {tabnr}]])
Number argument list id
argv( {nr}) String {nr} entry of the argument list
argv( ) List the argument list
+assertEqual( {exp}, {act}) none assert that {exp} equals {act}
+assertFalse( {actual}) none assert that {actual} is false
+assertTrue( {actual}) 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,31 @@ 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.
+ *assertEqual()*
+assertEqual({expected}, {actual})
+ 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.
+ Example: >
+ assertEqual('foo', 'bar')
+< Will result in a string to be added to |v:errors|:
+ test.vim line 12: Expected 'foo' but got 'bar' ~
+
+assertFalse({actual}) *assertFalse()*
+ When {actual} is not false an error message is added to
+ |v:errors|, like with |assertEqual()|..
+ A value is false when it is zero. When "{actual}" is not a
+ number the assert fails.
+
+assertTrue({actual}) *assertTrue()*
+ When {actual} is not true an error message is added to
+ |v:errors|, like with |assertEqual()|..
+ A value is true when it is a non-zeron number. When {actual}
+ is not a number the assert fails.
+
asin({expr}) *asin()*
Return the arc sine of {expr} measured in radians, as a |Float|
in the range of [-pi/2, pi/2].